diff --git a/.gitignore b/.gitignore index aa332681474..6aa74f44ed0 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ htdocs/includes/autoload.php htdocs/includes/bin/ htdocs/includes/composer/ /.pydevproject +/dolibarr_genesis.mp4 diff --git a/.travis.yml b/.travis.yml index d5583ef6ff2..3a996915ca7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -347,7 +347,7 @@ script: mysql -e 'DROP DATABASE IF EXISTS travis;' mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;' - mysql -e 'FLUSH PRIVILEGES;' + mysql -e 'FLUSH PRIVILEGES;' mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql fi if [ "$DB" = 'postgresql' ]; then @@ -362,7 +362,7 @@ script: #echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis fi echo - + - | echo "Upgrading Dolibarr" # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. diff --git a/ChangeLog b/ChangeLog index 0f4d3c30ddf..f6a1c949bf5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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(...) * Removed function dol_micro_time. Use native PHP microtime instead. * 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 ***** - FIX: #10460 compatibility with MariaDB 10.4 FIX: #11401 Adherent unknown language key FIX: #11422 Can't edit his own events with standard rights diff --git a/build/gource/README.md b/build/gource/README.md new file mode 100644 index 00000000000..548d01ebccb --- /dev/null +++ b/build/gource/README.md @@ -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 diff --git a/build/gource/avatars/.gitignore b/build/gource/avatars/.gitignore new file mode 100644 index 00000000000..b44ef384e2d --- /dev/null +++ b/build/gource/avatars/.gitignore @@ -0,0 +1 @@ +/*.png diff --git a/build/gource/avatars/README.md b/build/gource/avatars/README.md new file mode 100644 index 00000000000..c0b3c6d79af --- /dev/null +++ b/build/gource/avatars/README.md @@ -0,0 +1 @@ +Directory that will be filled with avatars images of developers for gource \ No newline at end of file diff --git a/build/gource/getavatars.pl b/build/gource/getavatars.pl new file mode 100755 index 00000000000..1f73da34e91 --- /dev/null +++ b/build/gource/getavatars.pl @@ -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() { + 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; + diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index bfdda2896a1..0c754b1c874 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -152,7 +152,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) $fuser = new User($db); $fuser->fetch(mt_rand(1, 2)); $fuser->getRights(); - + $result=$object->create($fuser); if ($result >= 0) { diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index 30c9471a281..ad8cf6025bb 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -176,7 +176,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) $fuser = new User($db); $fuser->fetch(mt_rand(1, 2)); $fuser->getRights(); - + $object->contactid = $contids[$socids[$socid]][0]; $object->socid = $socids[$socid]; $object->datep = $dates[mt_rand(1, count($dates)-1)]; @@ -200,7 +200,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) } $xnbp++; } - + $result=$object->valid($fuser); if ($result > 0) { diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index 54e17c7f8d7..f1e0f4f360b 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -116,7 +116,6 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++) $contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)]; if ( $contact->create($user) ) { - } } diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 6773e1d2c03..8c01eea6d99 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -122,14 +122,14 @@ - + 0 0 - + @@ -195,13 +195,13 @@ --> - + - + @@ -213,6 +213,8 @@ 0 + + @@ -337,7 +339,7 @@ - @@ -375,7 +377,7 @@ 0 - + 0 diff --git a/dev/tools/dolibarr-mysql2pgsql.pl b/dev/tools/dolibarr-mysql2pgsql.pl index 1f510ad60f1..2fe03aaf2b5 100755 --- a/dev/tools/dolibarr-mysql2pgsql.pl +++ b/dev/tools/dolibarr-mysql2pgsql.pl @@ -58,7 +58,7 @@ foreach my $file (keys %filelist) { $ARGV[1]="$DESTI/$file"; print "Convert file $ARGV[0] into $ARGV[1]\n"; - + # MySQL to PostgreSQL dump file converter # # For usage: perl mysql2pgsql.perl --help @@ -76,18 +76,18 @@ foreach my $file (keys %filelist) { # 4) add debug option # see rest of changelog at http://cvs.linux.hr/cvsweb.cgi/sql/mysql2pgsql # 2003-12-16 jsp -- Joe Speigle : - # converts: s/\) *Type=MyISAM;/);/i, enum data type -> references, + # converts: s/\) *Type=MyISAM;/);/i, enum data type -> references, # auto_increment->sequences # 2004-01-13 jsp -- moved project to gborg; both the above declined ownership # 2004-06-29 converts: year(4), year(2) - # homepage: gborg.postgresql.org - + # homepage: gborg.postgresql.org + GetOptions("debug", "help"); - + my $DEBUG = $opt_debug || 0; my $HELP = $opt_help || 0; - - + + if (($HELP) || ! defined($ARGV[0]) || ! defined($ARGV[1])) { print "Usage: perl $0 {--verbose|--help|--debug} mysql_dump_file.sql pg_dump_file.sql\n"; print "\t* OPTIONS\n"; @@ -106,15 +106,15 @@ foreach my $file (keys %filelist) { print "\tpg_dump_file.sql (undefined)\n"; } exit 1; - } - + } + open(IN,"<$ARGV[0]") || die "can't open mysql dump file $ARGV[0]"; open(OUT,">$ARGV[1]") || die "can't open pg dump file $ARGV[1]"; print OUT "-- Generated by $PROG\n"; print OUT "-- (c) 2004, PostgreSQL Inc.\n"; print OUT "-- (c) 2005, Laurent Destailleur.\n"; print OUT "\n"; - + # Output for create table and create index sub output_create { # If command ends with "xxx,);", we change to "xxx);" @@ -128,7 +128,7 @@ foreach my $file (keys %filelist) { print OUT $create_index; } } - + # Reset when moving from each "create table" to "insert" part of dump sub reset_vars() { $create_sql=""; @@ -137,24 +137,24 @@ foreach my $file (keys %filelist) { $enum_column=''; } - + # Boucle sur contenu fichier source #---------------------------------- while() { - + # comments or empty lines - if (/^-- \$Id/) { + if (/^-- \$Id/) { $_ =~ s/\$//g; - print OUT $_; + print OUT $_; next; } # comments or empty lines if (/^#/ || /^$/ || /^--/) { - print OUT $_; + print OUT $_; next; } - if (/^USE\s*([^;]*);/) { - print OUT "\\c ". $1; + if (/^USE\s*([^;]*);/) { + print OUT "\\c ". $1; next; } if ($create_sql ne "") { # we are inside create table statement so lets process datatypes @@ -167,14 +167,14 @@ foreach my $file (keys %filelist) { # LDR Added "innodb" and "engine" } elsif (/(ISAM|innodb)/i) { # end of create table sequence - s/\) *type=(MyISAM|innodb);/);/i; - s/\) *engine=(MyISAM|innodb);/);/i; + s/\) *type=(MyISAM|innodb);/);/i; + s/\) *engine=(MyISAM|innodb);/);/i; $create_sql =~ s/,$//g; # strip last , inside create table $create_sql .= $_; &output_create; &reset_vars(); next; - } + } # enum -> check if (/([\w\"]*)\s+enum\s*\(((?:['"][\?\w]+['"]\s*,)+['"][\?\w]+['"])\)(.*)$/i) { @@ -189,7 +189,7 @@ foreach my $file (keys %filelist) { $enum_datafield{$enum_column} =~ s/\"/\'/g; $_ = qq~ $enum_column CHAR($maxlength) CHECK ($enum_column IN ($enum_datafield{$enum_column})) $suite\n~; # int, auto_increment -> serial - } elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) { + } elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) { $seq = qq~${table}_${1}_seq~; s/[\s\t]*([a-zA-Z_0-9]*)\s*.*int.*auto_increment[^,]*/ $1 SERIAL PRIMARY KEY/ig; $create_sql.=$_; @@ -211,40 +211,40 @@ foreach my $file (keys %filelist) { elsif (/tinyint/i) { s/tinyint/smallint/g; } - + # nuke unsigned s/(int\w+|smallint)\s+unsigned/$1/gi; - + # blob -> text s/\w*blob/text/gi; # tinytext/mediumtext -> text s/tinytext/text/gi; s/mediumtext/text/gi; - + # char -> varchar # PostgreSQL would otherwise pad with spaces as opposed # to MySQL! Your user interface may depend on this! s/(\s+)char/${1}varchar/gi; - + # nuke date representation (not supported in PostgreSQL) s/datetime default '[^']+'/datetime/i; s/date default '[^']+'/datetime/i; s/time default '[^']+'/datetime/i; - + # change not null datetime field to null valid ones # (to support remapping of "zero time" to null s/datetime not null/datetime/i; s/datetime/timestamp/i; - + # nuke size of timestamp s/timestamp\([^)]*\)/timestamp/i; - + # double -> numeric s/^double/numeric/i; s/(\s*)double/${1}numeric/i; - + # float -> numeric s/^float/numeric/i; s/(\s*)float/${1}numeric/i; @@ -261,7 +261,7 @@ foreach my $file (keys %filelist) { $create_sql.=$_; next; } - + # unique key [name] (field) if (/unique key\s*(\w*)\s*\((\w+)\)/i) { s/unique key\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i; @@ -288,30 +288,30 @@ foreach my $file (keys %filelist) { $create_index .= "CREATE INDEX $idxname ON $table ($fieldlist);\n"; next; } - + # index(field) if (/index\s*(\w*)\s*\((\w+)\)/i) { my $idxname=($1?"$1":"idx_${table}_$2"); $create_index .= "CREATE INDEX $idxname ON $table ($2);\n"; next; } - + # primary key if (/\bkey\b/i && !/^\s+primary key\s+/i) { s/KEY(\s+)[^(]*(\s+)/$1 UNIQUE $2/i; # hack off name of the non-primary key } - + # key(xxx) if (/key\s*\((\w+)\)/i) { my $idxname="idx_${table}_$1"; $create_index .= "CREATE INDEX $idxname ON $table ($1);\n"; next; } - + # Quote column names 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) { 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."; @@ -330,13 +330,13 @@ foreach my $file (keys %filelist) { s!\x85!... !g; # \ldots s!\x92!`!g; } - + # fix dates '0000-00-00 00:00:00' (should be null) s/'0000-00-00 00:00:00'/null/gi; s/'0000-00-00'/null/gi; s/'00:00:00'/null/gi; s/([12]\d\d\d)([01]\d)([0-3]\d)([0-2]\d)([0-6]\d)([0-6]\d)/'$1-$2-$3 $4:$5:$6'/; - + if (/create\s+table\s+(\w+)/i) { $create_sql = $_; /create\s*table\s*(\w+)/i; @@ -345,11 +345,11 @@ foreach my $file (keys %filelist) { print OUT $_; } } # end of if inside create_table - } # END while() - + } # END while() + close IN; close OUT; - + } print "\n"; @@ -358,4 +358,4 @@ print "\n"; print "Press a key to finish...\n"; $stop=; -0; \ No newline at end of file +0; diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 06a2fb60d67..2f23cd3eae8 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -677,7 +677,6 @@ if ($id) { foreach ($fieldlist as $field => $value) { - $showfield=1; $class="left"; $valuetoshow=$obj->{$fieldlist[$field]}; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index c49ed42741b..f54c477ff52 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -273,7 +273,6 @@ if ($action == 'create') { print ''; } elseif ($id > 0 || $ref) { - $result = $object->fetch($id, $ref, 1); if ($result > 0) { diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index a7fe40acefc..5fdd43eb020 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -130,7 +130,6 @@ if (! empty($cat_id)) } 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 '
'; /*print ''; print ''; foreach ($list_account_main as $key) { - print ''; // Param $label = $langs->trans($key); diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 13d3a267956..6b47578761c 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -83,7 +83,6 @@ if (GETPOST('change_chart', 'alpha')) $chartofaccounts = GETPOST('chartofaccounts', 'int'); if (! empty($chartofaccounts)) { - if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) { $error ++; } @@ -144,7 +143,6 @@ print ''; print '
'; foreach ($list_account_main as $key) { - print ''; // Param $label = $langs->trans($key); @@ -172,7 +170,6 @@ print '
'; print '
'; foreach ($list_account as $key) { - print ''; // Param $label = $langs->trans($key); diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index e13a66998b7..e506f5bf512 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -114,7 +114,7 @@ if ($action == 'update') { $error ++; } } - } + } if (! $error) { // reload @@ -203,7 +203,6 @@ print "\n"; $num = count($main_option); if ($num) { foreach ($main_option as $key) { - print ''; // Param diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 5cc03376808..03404bd4126 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -45,7 +45,7 @@ $langs->loadLangs(array("admin","compta")); // Security check if ($user->societe_id > 0) 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(); $error = 0; @@ -112,7 +112,7 @@ if ($result) $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'); diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index f12aaba054b..d9125a686c6 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -33,7 +33,7 @@ $langs->loadLangs(array("admin","compta")); // Security check if ($user->societe_id > 0) accessforbidden(); -if (empty($user->rights->accounting->fiscalyear)) +if (empty($user->rights->accounting->fiscalyear->write)) accessforbidden(); $error = 0; @@ -300,7 +300,7 @@ if ($action == 'create') dol_fiche_end(); - if (! empty($user->rights->accounting->fiscalyear)) + if (! empty($user->rights->accounting->fiscalyear->write)) { /* * Barre d'actions diff --git a/htdocs/accountancy/admin/fiscalyear_info.php b/htdocs/accountancy/admin/fiscalyear_info.php index cfe6c20bd7b..dd62352e2b1 100644 --- a/htdocs/accountancy/admin/fiscalyear_info.php +++ b/htdocs/accountancy/admin/fiscalyear_info.php @@ -32,7 +32,7 @@ $langs->loadLangs(array("admin","compta")); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->fiscalyear) +if (! $user->rights->accounting->fiscalyear->write) accessforbidden(); $id = GETPOST('id', 'int'); diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 4cf2401d51b..0460f31af30 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -88,11 +88,11 @@ if ($action == 'setlistsorttodo') { if (! $res > 0) $error ++; - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } } if ($action == 'setlistsortdone') { @@ -100,11 +100,11 @@ if ($action == 'setlistsortdone') { $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } } if ($action == 'setmanagezero') { @@ -112,11 +112,11 @@ if ($action == 'setmanagezero') { $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } } if ($action == 'setdisabledirectinput') { @@ -124,11 +124,11 @@ if ($action == 'setdisabledirectinput') { $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } } if ($action == 'setenabledraftexport') { @@ -136,11 +136,11 @@ if ($action == 'setenabledraftexport') { $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } } if ($action == 'setenablesubsidiarylist') { diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index fcdf4de032c..44fe3e936cd 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -609,7 +609,6 @@ if ($id) $langs->load("accountancy"); foreach ($fieldlist as $field => $value) { - $showfield=1; $class="left"; $valuetoshow=$obj->{$fieldlist[$field]}; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 2922d3bdf23..091018dc909 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -117,7 +117,6 @@ if ($action == 'update') { ); if (in_array($accounting_product_mode, $accounting_product_modes)) { - if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) { $error ++; } @@ -129,7 +128,6 @@ if ($action == 'update') { if (! empty($btn_changeaccount)) { //$msg = '
' . $langs->trans("Processing") . '...
'; if (! empty($chk_prod)) { - $accounting = new AccountingAccount($db); //$msg .= '
' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '
'; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 3c04548d7c6..7d48790348d 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -279,8 +279,8 @@ if ($action != 'export_csv') print ''; } - // Affiche le compte comptable en debut de ligne - print ""; + // Show first line of a break + print ''; print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php index d0e9b940074..bdc78911513 100644 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ b/htdocs/accountancy/bookkeeping/balancebymonth.php @@ -105,7 +105,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $i < $num ) { - $row = $db->fetch_row($resql); print ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 5f9ba37d341..cc6307bae2c 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -83,7 +83,6 @@ $object = new BookKeeping($db); */ if ($action == "confirm_update") { - $error = 0; if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { @@ -585,7 +584,6 @@ if ($action == 'create') if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { - print load_fiche_titre($langs->trans("ListeMvts"), '', ''); print ''; @@ -601,7 +599,6 @@ if ($action == 'create') print "
' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . '
' . length_accountg($row[0]) . '
"; if (count($object->linesmvt) > 0) { - $total_debit = 0; $total_credit = 0; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 5cf64a70e67..5158e12ebb6 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -155,6 +155,12 @@ $arrayfields=array( 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 @@ -310,7 +316,6 @@ if (empty($reshook)) } if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { - $import_key = GETPOST('importkey', 'alpha'); 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) { - $delyear = GETPOST('delyear', 'int'); if ($delyear==-1) { $delyear=0; @@ -356,7 +360,6 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme } } if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) { - $mvt_num = GETPOST('mvt_num', 'int'); if (! empty($mvt_num)) { @@ -373,10 +376,96 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri 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, ...) +// Must be after definition of $sql 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); if ($result < 0) @@ -387,55 +476,54 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { { // Export files $accountancyexport = new AccountancyExport($db); - $accountancyexport->export($object->lines); + $accountancyexport->export($object->lines, $formatexportset); if (! empty($accountancyexport->errors)) { setEventMessages('', $accountancyexport->errors, 'errors'); - } else { + } + else + { // Specify as export : update field date_export - // TODO Move in class bookKeeping $error=0; $db->begin(); - if (is_array($object->lines)) { - foreach ($object->lines as $movement) { + if (is_array($object->lines)) + { + foreach ($object->lines as $movement) + { $now = dol_now(); + $sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping"; $sql .= " SET date_export = '" . $db->idate($now) . "'"; $sql .= " WHERE rowid = " . $movement->id; dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=" . $sql, LOG_DEBUG); $result = $db->query($sql); - if ($result) { - $db->commit(); - // setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs'); - } else { - $db->rollback(); - // setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors'); + if (! $result) + { + $error++; + break; } } } + + if (! $error) + { + $db->commit(); + // setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs'); + } + else + { + $error++; + $db->rollback(); + setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors'); + } } 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 @@ -443,31 +531,49 @@ if ($action == 'setreexport') { $title_page = $langs->trans("Bookkeeping"); -llxHeader('', $title_page); - -// List +// Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT); - if ($nbtotalofrecords < 0) { - setEventMessages($object->error, $object->errors, 'errors'); +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $resql = $db->query($sql); + $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 -$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT); -if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); + $resql=$db->query($sql); + if (! $resql) + { + dol_print_error($db); + exit; + } + + $num = $db->num_rows($resql); } -$num=count($object->lines); + +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $title_page); + if ($action == 'delmouv') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1); print $formconfirm; } if ($action == 'delbookkeepingyear') { - $form_question = array (); $delyear = GETPOST('delyear'); $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; print ''; +print ''; print ''; if ($optioncss != '') print ''; -print ''; print ''; print ''; print ''; print ''; -$button .= ''; - -$listofformat=AccountancyExport::getType(); if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList"); else $buttonLabel = $langs->trans("ExportList"); // Button re-export if (! empty($conf->global->ACCOUNTING_REEXPORT)) { - $newcardbutton =''.img_picto($langs->trans("Activated"), 'switch_on').' '; + $newcardbutton =''.img_picto($langs->trans("Activated"), 'switch_on').' '; } else { - $newcardbutton =''.img_picto($langs->trans("Disabled"), 'switch_off').' '; + $newcardbutton =''.img_picto($langs->trans("Disabled"), 'switch_off').' '; } $newcardbutton.= ''.$langs->trans("IncludeDocsAlreadyExported").''; -$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('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; $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; print '
'; -print '
'; +print '
'; // Filters lines print ''; @@ -650,7 +753,6 @@ if (! empty($arrayfields['t.code_journal']['checked'])) print ''; } - // Fields from hook $parameters=array('arrayfields'=>$arrayfields); $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 "\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 ''; + + // Piece number + if (! empty($arrayfields['t.piece_num']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Document date + if (! empty($arrayfields['t.doc_date']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Document ref + if (! empty($arrayfields['t.doc_ref']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Account number + if (! empty($arrayfields['t.numero_compte']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Subledger account + if (! empty($arrayfields['t.subledger_account']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Label operation + if (! empty($arrayfields['t.label_operation']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Amount debit + if (! empty($arrayfields['t.debit']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield']; + $totalarray['totaldebit'] += $line->debit; + } + + // Amount credit + if (! empty($arrayfields['t.credit']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield']; + $totalarray['totalcredit'] += $line->credit; + } + + // Lettering code + if (! empty($arrayfields['t.lettering_code']['checked'])) + { + print ''; + 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 ''; + 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 ''; + if (! $i) $totalarray['nbfield']++; + } + + // Modification operation date + if (! empty($arrayfields['t.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Exported operation date + if (! empty($arrayfields['t.date_export']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Action column + print ''; + + if (! $i) $totalarray['nbfield']++; + + print "\n"; + + $i++; +} + +// Show total line +if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield'])) { $i=0; - $totalarray=array(); - while ($i < min($num, $limit)) + print ''; + while ($i < $totalarray['nbfield']) { - $line = $object->lines[$i]; - - $total_debit += $line->debit; - $total_credit += $line->credit; - - print ''; - - // Piece number - if (! empty($arrayfields['t.piece_num']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Document date - if (! empty($arrayfields['t.doc_date']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Document ref - if (! empty($arrayfields['t.doc_ref']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Account number - if (! empty($arrayfields['t.numero_compte']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Subledger account - if (! empty($arrayfields['t.subledger_account']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Label operation - if (! empty($arrayfields['t.label_operation']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Amount debit - if (! empty($arrayfields['t.debit']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield']; - $totalarray['totaldebit'] += $line->debit; - } - - // Amount credit - if (! empty($arrayfields['t.credit']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield']; - $totalarray['totalcredit'] += $line->credit; - } - - // Lettering code - if (! empty($arrayfields['t.lettering_code']['checked'])) - { - print ''; - 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 ''; - 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 ''; - if (! $i) $totalarray['nbfield']++; - } - - // Modification operation date - if (! empty($arrayfields['t.tms']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Exported operation date - if (! empty($arrayfields['t.date_export']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Action column - print ''; - - if (! $i) $totalarray['nbfield']++; - - print "\n"; - $i++; - } - - // Show total line - if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield'])) - { - $i=0; - print ''; - while ($i < $totalarray['nbfield']) + if ($i == 1) { - $i++; - if ($i == 1) - { - if ($num < $limit && empty($offset)) print ''; - else print ''; - } - elseif ($totalarray['totaldebitfield'] == $i) print ''; - elseif ($totalarray['totalcreditfield'] == $i) print ''; - else print ''; + if ($num < $limit && empty($offset)) print ''; + else print ''; } - $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 ''; + elseif ($totalarray['totaldebitfield'] == $i) print ''; + elseif ($totalarray['totalcreditfield'] == $i) print ''; + else print ''; } + $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 ''; } + print "
'; + $object->id = $line->id; + $object->piece_num = $line->piece_num; + print $object->getNomUrl(1, '', 0, '', 1); + print '' . dol_print_date($line->doc_date, 'day') . '' . $line->doc_ref . '' . length_accountg($line->numero_compte) . '' . length_accounta($line->subledger_account) . '' . $line->label_operation . '' . ($line->debit ? price($line->debit) : ''). '' . ($line->credit ? price($line->credit) : '') . '' . $line->lettering_code . '' . $journaltoshow . '' . dol_print_date($line->date_creation, 'dayhour') . '' . dol_print_date($line->date_modification, 'dayhour') . '' . dol_print_date($line->date_export, 'dayhour') . ''; + if (empty($line->date_export)) { + if ($user->rights->accounting->mouvements->creer) { + print '' . img_edit() . ''; + } + if ($user->rights->accounting->mouvements->supprimer) { + print ' ' . img_delete() . ''; + } + } + print '
'; - $object->id = $line->id; - $object->piece_num = $line->piece_num; - print $object->getNomUrl(1, '', 0, '', 1); - print '' . dol_print_date($line->doc_date, 'day') . '' . $line->doc_ref . '' . length_accountg($line->numero_compte) . '' . length_accounta($line->subledger_account) . '' . $line->label_operation . '' . ($line->debit ? price($line->debit) : ''). '' . ($line->credit ? price($line->credit) : '') . '' . $line->lettering_code . '' . $journaltoshow . '' . dol_print_date($line->date_creation, 'dayhour') . '' . dol_print_date($line->date_modification, 'dayhour') . '' . dol_print_date($line->date_export, 'dayhour') . ''; - if (empty($line->date_export)) { - if ($user->rights->accounting->mouvements->creer) { - print '' . img_edit() . ''; - } - if ($user->rights->accounting->mouvements->supprimer) { - print ' ' . img_delete() . ''; - } - } - print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totaldebit']).''.price($totalarray['totalcredit']).''.$langs->trans("Total").''.$langs->trans("Totalforthispage").'
'.price($totalarray['totaldebit']).''.price($totalarray['totalcredit']).'
"; print ''; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index d3dc9b4a190..4f275e3e2b0 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -37,9 +37,6 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; // Load translation files required by the page $langs->loadLangs(array("accountancy")); -$page = GETPOST("page"); -$sortorder = GETPOST("sortorder"); -$sortfield = GETPOST("sortfield"); $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_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; $pagenext = $page + 1; 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.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'"; $sql.= $db->plimit(1); @@ -182,7 +179,6 @@ if (! empty($search_credit)) { if ($action == 'delmouvconfirm') { - $mvt_num = GETPOST('mvt_num', 'int'); if (! empty($mvt_num)) { @@ -232,7 +228,6 @@ if ($action == 'delmouv') { print $formconfirm; } if ($action == 'delbookkeepingyear') { - $form_question = array (); $delyear = GETPOST('delyear'); @@ -255,6 +250,14 @@ if ($action == 'delbookkeepingyear') { print ''; +print ''; +print ''; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; + $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'); @@ -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); // Reverse sort order -if ( preg_match('/^asc/i', $sortorder) ) - $sortorder = "asc"; -else - $sortorder = "desc"; +if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc"; +else $sortorder = "desc"; -print ''; +print '
'; +print '
'; print ''; print ''; +print ''; print ''; 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 "\n"; -print ''; - $total_debit = 0; $total_credit = 0; @@ -335,7 +336,6 @@ while ($i < min($num, $limit)) // Is it a break ? if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) { - // Affiche un Sous-Total par compte comptable if (isset($displayed_account_number)) { print ''; @@ -376,8 +376,8 @@ while ($i < min($num, $limit)) print strlen(length_accounta($line->subledger_account)) == 0 ? '' : ''; - print ''; - print ''; + print ''; + print ''; $accountingjournal = new AccountingJournal($db); $result = $accountingjournal->fetch('', $line->code_journal); @@ -397,27 +397,32 @@ while ($i < min($num, $limit)) $i++; } -// Affiche un Sous-Total du dernier compte comptable affiché +// Show sub-total of last shown account print ''; print ''; -print "\n"; -print "\n"; +print ''; +print ''; print ''; -// Affiche le Total +// Show total print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; print ''; print "
'; @@ -300,6 +302,7 @@ print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).'' . $line->label_operation . '' . $line->label_operation . '
(' . length_accounta($line->subledger_account) . ')
' . ($line->debit ? price($line->debit) :''). '' . ($line->credit ? price($line->credit) : '') . '' . ($line->debit ? price($line->debit) :''). '' . ($line->credit ? price($line->credit) : '') . '
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).'  '; +print price($sous_total_debit - $sous_total_credit); +print '
'.$langs->trans("Total").':'; +print ''; print price($total_debit); print ''; +print ''; print price($total_credit); print '
"; +print ''; + print ''; // End of page diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index b7a19101758..4bc60fc904f 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -100,7 +100,6 @@ if ($result < 0) */ if ($action == 'lettering') { - $result = $lettering->updateLettering($toselect); if ($result < 0) { @@ -251,7 +250,6 @@ if ($resql) { $tmp = ''; while ( $obj = $db->fetch_object($resql) ) { - 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); diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index eaa741e1722..df513f8d074 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -99,7 +99,6 @@ if ($result<0) * Action */ if ($action == 'lettering') { - $result = $lettering->updateLettering($toselect); if ($result < 0) { @@ -248,7 +247,6 @@ if ($resql) { $solde = 0; $tmp = ''; while ($obj = $db->fetch_object($resql)) { - 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); diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index dac238f97d6..7e8f14f2a53 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -224,22 +224,23 @@ class AccountancyExport /** * Function who chose which export to use with the default config, and make the export into a file * - * @param array $TData data - * @return void + * @param array $TData Array with data + * @param int $formatexportset Id of export format + * @return void */ - public function export(&$TData) + public function export(&$TData, $formatexportset) { global $conf, $langs; global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php // 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'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; - switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) { + switch ($formatexportset) { case self::$EXPORT_TYPE_CONFIGURABLE : $this->exportConfigurable($TData); break; @@ -548,7 +549,6 @@ class AccountancyExport $end_line = "\n"; foreach ($objectLines as $line) { - $date = dol_print_date($line->doc_date, '%d%m%Y'); print $line->id . $separator; @@ -584,7 +584,6 @@ class AccountancyExport $end_line = "\n"; foreach ($objectLines as $line) { - $date = dol_print_date($line->doc_date, '%d%m%Y'); print $line->piece_num . $separator; @@ -624,7 +623,6 @@ class AccountancyExport $end_line = "\n"; foreach ($objectLines as $line) { - $date = dol_print_date($line->doc_date, '%d/%m/%Y'); print $date . $separator; @@ -926,91 +924,130 @@ class AccountancyExport * * @return void */ - public function exportLDCompta($objectLines) - { + public function exportLDCompta($objectLines) + { - $separator = ';'; - $end_line = "\n"; + $separator = ';'; + $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'); - $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); + // TYPE + $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 - $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; - } - } + print $end_line; + } + } /** * Export format : Charlemagne @@ -1046,7 +1083,6 @@ class AccountancyExport print $end_line; foreach($objectLines as $line) { - $date = dol_print_date($line->doc_date, '%Y%m%d'); print $date . $separator; //Date diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index f9c2e3391ba..21cbdeb9662 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -407,7 +407,6 @@ class AccountingAccount extends CommonObject $result = $this->checkUsage(); if ($result > 0) { - $this->db->begin(); // if (! $error) { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 16dc458d833..b4e747d65f3 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1584,9 +1584,7 @@ class BookKeeping extends CommonObject dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - while ($obj = $this->db->fetch_object($result)) { - $line = new BookKeepingLine(); $line->id = $obj->rowid; @@ -1966,6 +1964,7 @@ class BookKeepingLine public $credit; public $montant; public $sens; + public $lettering_code; /** * @var int ID @@ -1977,4 +1976,6 @@ class BookKeepingLine public $journal_label; public $piece_num; public $date_creation; + public $date_modification; + public $date_export; } diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index e20b49dbd25..ef63fc8b15f 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -149,7 +149,6 @@ class Lettering extends BookKeeping } } } elseif ($obj->type == 'payment') { - $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 .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; diff --git a/htdocs/accountancy/closure/index.html b/htdocs/accountancy/closure/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php new file mode 100644 index 00000000000..ddf3b4cf2db --- /dev/null +++ b/htdocs/accountancy/closure/index.php @@ -0,0 +1,132 @@ + + * + * 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 . + * + */ + +/** + * \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 = '' . img_previous() . ''; +$textnextyear = ' ' . img_next() . ''; + + +print load_fiche_titre($langs->trans("Closure") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy'); + +print ''.$langs->trans("DescClosure") . '
'; +print '
'; + + +$y = $year_current; + +$buttonbind = '' . $langs->trans("ValidateMovements") . ''; + +print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); + +print '
'; +print ''; +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 ''; +} +print ''; + +$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 ''; + for($i = 1; $i <= 12; $i ++) { + print ''; + } + print ''; + print ''; + } + + $db->free($resql); +} else { + print $db->lasterror(); // Show last sql error +} +print "
' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $row[$i] . '' . $row[13] . '
\n"; +print '
'; + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/accountancy/closure/validate.php b/htdocs/accountancy/closure/validate.php new file mode 100644 index 00000000000..26b53009fcc --- /dev/null +++ b/htdocs/accountancy/closure/validate.php @@ -0,0 +1,157 @@ + + * + * 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 . + * + */ + +/** + * \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 = '' . img_previous() . ''; +$textnextyear = ' ' . img_next() . ''; + + +print load_fiche_titre($langs->trans("ValidateMovements") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy'); + +print $langs->trans("DescValidateMovements") . '
'; +print '
'; + + +$y = $year_current; + +print_barre_liste($langs->trans("SelectMonthAndValidate"), '', '', '', '', '', '', -1, '', '', 0, '', 'class="right"', 0, 1, 1); + +print '
'; +print ''; +print ''; +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 ''; +} +print ''; + +print ''; +$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 '' ; + } + print ''; + } + + $db->free($resql); +} else { + print $db->lasterror(); // Show last sql error +} +print ''; +print "
' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $row[$i] . '

'; + print ''; + print '
' . $row[13] . '
\n"; + +print '
'; +print '
'; + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 52057485a30..00c4a945ff9 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -112,7 +112,6 @@ if (! empty($id)) { $i = 0; if ($num_lines) { - $objp = $db->fetch_object($result); print '
' . "\n"; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 68649aa264d..c0e45916922 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -29,6 +29,7 @@ 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 . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; // Load translation files required by the page @@ -65,6 +66,8 @@ $year_current = $year_start; // Validate History $action = GETPOST('action', 'aZ09'); +$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); + /* * Actions @@ -97,12 +100,11 @@ if ($action == 'clean' || $action == 'validatehistory') } if ($action == 'validatehistory') { - $error = 0; $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 - if ($db->type == 'pgsql') { + /*if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet"; $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"; @@ -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 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; $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'); - - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - $db->rollback(); + $result = $db->query($sql); + if (! $result) { + $error++; setEventMessages($db->lasterror(), null, 'errors'); } 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(); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } @@ -195,7 +264,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print ''; if ($row[0] == 'tobind') { @@ -271,7 +339,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print ''; 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); while ($row = $db->fetch_row($resql)) { - print '' . $row[0] . ''; for($i = 1; $i <= 12; $i ++) { print '' . price(price2num($row[$i])) . ''; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 3385eb99b0e..6a5196288e2 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -358,6 +358,7 @@ if ($result) { // Ref Invoice print '' . $facture_static->getNomUrl(1) . ''; + // Date invoice print '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; // Ref Product @@ -377,7 +378,13 @@ if ($result) { print '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . ''; - print '' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + // Country + print ''; + if ($objp->country_code) + { + print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + } + print ''; print '' . $objp->tva_intra . ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 96520c4756c..d4cc5f59388 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -180,8 +180,6 @@ if ($massaction == 'ventil') { } $msg.=''; $msg.= '
' . $langs->trans("EndProcessing") . '
'; - //} 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.= " 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.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 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 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"; // Add search filter like @@ -249,7 +247,7 @@ if (strlen(trim($search_account))) { $sql .= natural_search("aa.account_number", $search_account); } 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); if (strlen(trim($search_country))) { @@ -408,7 +406,7 @@ if ($result) { $isSellerInEEC = isInEEC($mysoc); - while ( $i < min($num_lines, $limit) ) { + while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); $objp->code_sell_l = ''; @@ -520,6 +518,7 @@ if ($result) { print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')); print ''; + // Country print ''; $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; diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index d3fc63d3bf8..ea855921c5a 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -94,7 +94,6 @@ if ($action == 'clean' || $action == 'validatehistory') } if ($action == 'validatehistory') { - $error = 0; $db->begin(); @@ -187,7 +186,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print ''; if ($row[0] == 'tobind') { @@ -259,7 +257,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print ''; if ($row[0] == 'tobind') { diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 77a97b86322..1ec89dfc9cc 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -161,8 +161,6 @@ if ($massaction == 'ventil') { } $msg.=''; $msg.= '
' . $langs->trans("EndProcessing") . '
'; - //} else { - // setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); } } diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 4eab81ea49f..0eeccbd3395 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -88,7 +88,7 @@ if ($conf->accounting->enabled) } - print load_fiche_titre($langs->trans("AccountancyArea"), $showtutorial . $resultboxes['selectboxlist'], 'accountancy'); + print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial); print '
'; // hideobject is to start hidden print "
\n"; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index b36da4a2855..7063f7fd53e 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2019 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2018 Frédéric France @@ -167,7 +167,6 @@ $journal_label = $accountingjournalstatic->label; dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result); //print $sql; @@ -268,10 +267,8 @@ if ($result) { // get_url may return -1 which is not traversable if (is_array($links) && count($links) > 0) { - // Now loop on each link of record in bank. 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'))) { // So we excluded 'company' and 'user' here. We want only payment lines @@ -387,7 +384,9 @@ if ($result) { $tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id; $paymentvariousstatic->fetch($paymentvariousstatic->id); $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') { $paymentloanstatic->id = $links[$key]['url_id']; $paymentloanstatic->ref = $links[$key]['url_id']; @@ -660,11 +659,11 @@ if (! $error && $action == 'writebookkeeping') { $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; } elseif ($tabtype[$key] == 'payment_various') { - $bookkeeping->subledger_account = ''; - $bookkeeping->subledger_label = ''; - $bookkeeping->numero_compte = $k; + $bookkeeping->subledger_account = $k; + $bookkeeping->subledger_label = $tabcompany[$key]['name']; + $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; } elseif ($tabtype[$key] == 'banktransfert') { $bookkeeping->subledger_account = ''; @@ -997,7 +996,7 @@ if (empty($action) || $action == 'view') { if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { - print ''; + print ''; } else { if ($in_bookkeeping == 'notyet') print ''; @@ -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_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT; 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); if (empty($accounttoshow) || $accounttoshow == 'NotDefined') { @@ -1156,7 +1156,7 @@ if (empty($action) || $action == 'view') { // Subledger account print ""; - 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); if ($accounttoshow != $accounttoshowsubledger) diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 23d97360563..c61cdda4d48 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -115,7 +115,6 @@ $sql .= " ORDER BY er.date_debut"; dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG); $result = $db->query($sql); if ($result) { - $taber = array (); $tabht = array (); $tabtva = array (); @@ -307,49 +306,49 @@ if ($action == 'writebookkeeping') { foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { - // get compte id and label - $bookkeeping = new BookKeeping($db); - $bookkeeping->doc_date = $val["date"]; - $bookkeeping->doc_ref = $val["ref"]; - $bookkeeping->date_creation = $now; - $bookkeeping->doc_type = 'expense_report'; - $bookkeeping->fk_doc = $key; - $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; - $bookkeeping->subledger_account = ''; - $bookkeeping->subledger_label = ''; - $bookkeeping->numero_compte = $k; + // get compte id and label + $bookkeeping = new BookKeeping($db); + $bookkeeping->doc_date = $val["date"]; + $bookkeeping->doc_ref = $val["ref"]; + $bookkeeping->date_creation = $now; + $bookkeeping->doc_type = 'expense_report'; + $bookkeeping->fk_doc = $key; + $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; + $bookkeeping->subledger_account = ''; + $bookkeeping->subledger_label = ''; + $bookkeeping->numero_compte = $k; - $accountingaccount->fetch($k, null, true); - $bookkeeping->label_compte = $accountingaccount->label; + $accountingaccount->fetch($k, null, true); + $bookkeeping->label_compte = $accountingaccount->label; - $bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'; - $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; + $bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'; + $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; + $totaldebit += $bookkeeping->debit; + $totalcredit += $bookkeeping->credit; - $result = $bookkeeping->create($user); - if ($result < 0) { - if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists - { - $error++; - $errorforline++; - //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); + $result = $bookkeeping->create($user); + if ($result < 0) { + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists + { + $error++; + $errorforline++; + //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"; 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->name = $tabuser[$key]['name']; + $userstatic->id = $tabuser[$key]['id']; + $userstatic->name = $tabuser[$key]['name']; - // Fees - foreach ($tabht[$key] as $k => $mt) { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch(null, $k, true); - if ($mt) { - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; - print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; - print "\n"; + // Fees + foreach ($tabht[$key] as $k => $mt) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch(null, $k, true); + if ($mt) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; + print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; + print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; + print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; + print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; + print "\n"; + } } - } - // VAT - foreach ($tabtva[$key] as $k => $mt) { - if ($mt) { - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; - print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; - print "\n"; + // VAT + foreach ($tabtva[$key] as $k => $mt) { + if ($mt) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; + print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; + print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep; + print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; + print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; + print "\n"; + } } - } - // Third party - foreach ($tabttc[$key] as $k => $mt) { - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; - print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - print '"' . dol_trunc($userstatic->name) . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"'; - } - print "\n"; + // Third party + foreach ($tabttc[$key] as $k => $mt) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; + print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; + print '"' . dol_trunc($userstatic->name) . '"' . $sep; + print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; + print '"' . ($mt >= 0 ? price($mt) : '') . '"'; + } + print "\n"; } } if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("ExpenseReportsJournal")); $nom = $langs->trans("ExpenseReportsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); @@ -640,29 +638,29 @@ if (empty($action) || $action == 'view') { if ($numtax == 2) $arrayofvat = $tablocaltax2; foreach ($arrayofvat[$key] as $k => $mt) { - if ($mt) { - print ''; - print ""; - print "" . $date . ""; - print "" . $expensereportstatic->getNomUrl(1) . ""; - // Account - print ""; - $accountoshow = length_accountg($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("VATAccountNotDefined").''; + if ($mt) { + print ''; + print ""; + print "" . $date . ""; + print "" . $expensereportstatic->getNomUrl(1) . ""; + // Account + print ""; + $accountoshow = length_accountg($k); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("VATAccountNotDefined").''; + } + else print $accountoshow; + print ""; + // Subledger account + print ""; + print ''; + print "" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:''); + print ""; + print '' . ($mt >= 0 ? price($mt) : '') . ""; + print '' . ($mt < 0 ? price(- $mt) : '') . ""; + print ""; } - else print $accountoshow; - print ""; - // Subledger account - print ""; - print ''; - print "" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:''); - print ""; - print '' . ($mt >= 0 ? price($mt) : '') . ""; - print '' . ($mt < 0 ? price(- $mt) : '') . ""; - print ""; - } } } } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index c83c004c6b2..a3728c7f6f9 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -242,7 +242,6 @@ if ($action == 'writebookkeeping') { $invoicestatic = new FactureFournisseur($db); foreach ($tabfac as $key => $val) { // Loop on each invoice - $errorforline = 0; $totalcredit = 0; @@ -295,7 +294,61 @@ if ($action == 'writebookkeeping') { if (! $errorforline) { 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->doc_date = $val["date"]; $bookkeeping->date_lim_reglement = $val["datereg"]; @@ -303,20 +356,17 @@ if ($action == 'writebookkeeping') { $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->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->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 . ' - ' . $langs->trans("SubledgerAccount"); + $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->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; @@ -342,62 +392,7 @@ if ($action == 'writebookkeeping') { 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') { - llxHeader('', $langs->trans("PurchasesJournal")); $nom = $langs->trans("PurchasesJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); @@ -867,34 +861,32 @@ if (empty($action) || $action == 'view') { // Third party foreach ($tabttc[$key] as $k => $mt) { - //if ($mt) { - print ''; - print ""; - print "" . $date . ""; - print "" . $invoicestatic->getNomUrl(1) . ""; - // Account - print ""; - $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("MainAccountForSuppliersNotDefined").''; - } - else print $accountoshow; - print ''; - // Subledger account - print ""; - $accountoshow = length_accounta($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("ThirdpartyAccountNotDefined").''; - } - else print $accountoshow; - print ''; - print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . ""; - print ''. ($mt < 0 ? price(- $mt) : '') . ""; - print '' . ($mt >= 0 ? price($mt) : '') . ""; - print ""; - //} + print ''; + print ""; + print "" . $date . ""; + print "" . $invoicestatic->getNomUrl(1) . ""; + // Account + print ""; + $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("MainAccountForSuppliersNotDefined").''; + } + else print $accountoshow; + print ''; + // Subledger account + print ""; + $accountoshow = length_accounta($k); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("ThirdpartyAccountNotDefined").''; + } + else print $accountoshow; + print ''; + print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . ""; + print ''. ($mt < 0 ? price(- $mt) : '') . ""; + print '' . ($mt >= 0 ? price($mt) : '') . ""; + print ""; } // Product / Service @@ -902,30 +894,28 @@ if (empty($action) || $action == 'view') { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch(null, $k, true); - //if ($mt) { - print ''; - print ""; - print "" . $date . ""; - print "" . $invoicestatic->getNomUrl(1) . ""; - // Account - print ""; - $accountoshow = length_accountg($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("ProductAccountNotDefined").''; - } - else print $accountoshow; - print ""; - // Subledger account - print ""; - print ''; - $companystatic->id = $tabcompany[$key]['id']; - $companystatic->name = $tabcompany[$key]['name']; - print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . ""; - print '' . ($mt >= 0 ? price($mt) : '') . ""; - print '' . ($mt < 0 ? price(- $mt) : '') . ""; - print ""; - //} + print ''; + print ""; + print "" . $date . ""; + print "" . $invoicestatic->getNomUrl(1) . ""; + // Account + print ""; + $accountoshow = length_accountg($k); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("ProductAccountNotDefined").''; + } + else print $accountoshow; + print ""; + // Subledger account + print ""; + print ''; + $companystatic->id = $tabcompany[$key]['id']; + $companystatic->name = $tabcompany[$key]['name']; + print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . ""; + print '' . ($mt >= 0 ? price($mt) : '') . ""; + print '' . ($mt < 0 ? price(- $mt) : '') . ""; + print ""; } // VAT diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 17b2657b5dc..367fa2eb817 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -124,7 +124,7 @@ if ($in_bookkeeping == 'already') 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 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"; //print $sql; @@ -255,7 +255,6 @@ if ($action == 'writebookkeeping') { $invoicestatic = new Facture($db); foreach ($tabfac as $key => $val) { // Loop on each invoice - $errorforline = 0; $totalcredit = 0; @@ -306,7 +305,61 @@ if ($action == 'writebookkeeping') { if (! $errorforline) { 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->doc_date = $val["date"]; $bookkeeping->date_lim_reglement = $val["datereg"]; @@ -316,18 +369,15 @@ if ($action == 'writebookkeeping') { $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->subledger_account = ''; + $bookkeeping->subledger_label = ''; + $bookkeeping->numero_compte = $k; $bookkeeping->label_compte = $accountingaccount->label; - - $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount"); + $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->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; @@ -353,62 +403,7 @@ if ($action == 'writebookkeeping') { 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') { - llxHeader('', $langs->trans("SellsJournal")); $nom = $langs->trans("SellsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); @@ -803,34 +797,32 @@ if (empty($action) || $action == 'view') { // Third party foreach ($tabttc[$key] as $k => $mt) { - //if ($mt) { - print ''; - print ""; - print "" . $date . ""; - print "" . $invoicestatic->getNomUrl(1) . ""; - // Account - print ""; - $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("MainAccountForCustomersNotDefined").''; - } - else print $accountoshow; - print ''; - // Subledger account - print ""; - $accountoshow = length_accounta($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("ThirdpartyAccountNotDefined").''; - } - else print $accountoshow; - print ''; - print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . ""; - print '' . ($mt >= 0 ? price($mt) : '') . ""; - print '' . ($mt < 0 ? price(- $mt) : '') . ""; - print ""; - //} + print ''; + print ""; + print "" . $date . ""; + print "" . $invoicestatic->getNomUrl(1) . ""; + // Account + print ""; + $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("MainAccountForCustomersNotDefined").''; + } + else print $accountoshow; + print ''; + // Subledger account + print ""; + $accountoshow = length_accounta($k); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("ThirdpartyAccountNotDefined").''; + } + else print $accountoshow; + print ''; + print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . ""; + print '' . ($mt >= 0 ? price($mt) : '') . ""; + print '' . ($mt < 0 ? price(- $mt) : '') . ""; + print ""; } // Product / Service @@ -839,30 +831,28 @@ if (empty($action) || $action == 'view') { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch(null, $k, true); - //if ($mt) { - print ''; - print ""; - print "" . $date . ""; - print "" . $invoicestatic->getNomUrl(1) . ""; - // Account - print ""; - $accountoshow = length_accountg($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("ProductNotDefined").''; - } - else print $accountoshow; - print ""; - // Subledger account - print ""; - print ''; - $companystatic->id = $tabcompany[$key]['id']; - $companystatic->name = $tabcompany[$key]['name']; - print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . ""; - print '' . ($mt < 0 ? price(- $mt) : '') . ""; - print '' . ($mt >= 0 ? price($mt) : '') . ""; - print ""; - //} + print ''; + print ""; + print "" . $date . ""; + print "" . $invoicestatic->getNomUrl(1) . ""; + // Account + print ""; + $accountoshow = length_accountg($k); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("ProductNotDefined").''; + } + else print $accountoshow; + print ""; + // Subledger account + print ""; + print ''; + $companystatic->id = $tabcompany[$key]['id']; + $companystatic->name = $tabcompany[$key]['name']; + print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . ""; + print '' . ($mt < 0 ? price(- $mt) : '') . ""; + print '' . ($mt >= 0 ? price($mt) : '') . ""; + print ""; } // VAT diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 88a599d1fc5..bfb6e7b02e4 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -27,6 +27,7 @@ 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 . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; // Load translation files required by the page @@ -63,6 +64,7 @@ $year_current = $year_start; // Validate History $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') { - $error = 0; $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 - if ($db->type == 'pgsql') { + /*if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $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"; @@ -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 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; $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'); - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - $db->rollback(); + $result = $db->query($sql); + if (! $result) { + $error++; setEventMessages($db->lasterror(), null, 'errors'); } 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(); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } @@ -187,7 +257,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print ''; if ($row[0] == 'tobind') { @@ -258,7 +327,6 @@ if ($resql) { $num = $db->num_rows($resql); while ( $row = $db->fetch_row($resql)) { - print ''; if ($row[0] == 'tobind') { diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 97f1c771122..730aecf9dc1 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -192,12 +192,12 @@ if ($search_lineid) { if (strlen(trim($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))) { $sql .= natural_search("p.ref", $search_ref); } -if (strlen(trim($search_label))) { - $sql .= natural_search("p.label", $search_label); -} if (strlen(trim($search_desc))) { $sql .= natural_search("l.description", $search_desc); } @@ -300,14 +300,13 @@ if ($result) { print ''; print ''; print ''; - print ''; + print ''; print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($search_year, 'search_year', 1, 20, 5); print ''; print ''; - //print ''; print ''; print ''; print ''; @@ -368,6 +367,7 @@ if ($result) { print $objp->invoice_label; print ''; + // Date invoice print '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; // Ref product @@ -388,7 +388,12 @@ if ($result) { print '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . ''; - print '' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + print ''; + if ($objp->country_code) + { + print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; + } + print ''; print '' . $objp->tva_intra . ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 6ba3e244582..3c61b7a0608 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -184,8 +184,6 @@ if ($massaction == 'ventil') { } $msg.='
'; $msg.= '
' . $langs->trans("EndProcessing") . '
'; - //} 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.= " 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.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.= " AND l.product_type <= 2"; // Add search filter like @@ -234,12 +232,12 @@ if ($search_lineid) { if (strlen(trim($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))) { $sql .= natural_search("p.ref", $search_ref); } -if (strlen(trim($search_label))) { - $sql .= natural_search("p.label", $search_label); -} if (strlen(trim($search_desc))) { $sql .= natural_search("l.description", $search_desc); } @@ -309,14 +307,15 @@ if ($result) { $arrayofselected=is_array($toselect)?$toselect:array(); $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid); if ($search_day) $param.='&search_day='.urlencode($search_day); if ($search_month) $param.='&search_month='.urlencode($search_month); if ($search_year) $param.='&search_year='.urlencode($search_year); if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice); 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_amount) $param.='&search_amount='.urlencode($search_amount); if ($search_vat) $param.='&search_vat='.urlencode($search_vat); @@ -362,14 +361,13 @@ if ($result) { print ''; print ''; print ''; - print ''; + print ''; print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($search_year, 'search_year', 1, 20, 5); print ''; print ''; - //print ''; print ''; print ''; print ''; @@ -465,7 +463,7 @@ if ($result) { print '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; - // Ref product + // Ref Product print ''; if ($product_static->id > 0) print $product_static->getNomUrl(1); @@ -473,7 +471,7 @@ if ($result) { print ''; // Description - print ''; + print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description); diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php index 87190bef2fe..9c6f657d5e0 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php @@ -26,17 +26,12 @@ if (empty($conf) || ! is_object($conf)) $contact = $GLOBALS['objcanvas']->control->object; -?> +echo "\n"; +echo $this->control->tpl['showhead']; - -control->tpl['showhead']; ?> - -control->tpl['error'], $this->control->tpl['errors']); -?> - -control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; ?> -control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?> +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']; ?> @@ -121,29 +116,28 @@ dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors'
-control->tpl['showend']; ?> +control->tpl['showend']; -societe_id)) { ?> -
+if (empty($user->societe_id)) { + echo '
'; -rights->adherent->creer) { ?> -">trans('Modify'); ?> - + if ($user->rights->adherent->creer) { + echo ''.$langs->trans('Modify').''; + } -control->tpl['user_id'] && $user->rights->user->user->creer) { ?> -">trans("CreateDolibarrLogin"); ?> - + if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) { + echo ''.$langs->trans("CreateDolibarrLogin").''; + } -rights->adherent->supprimer) { ?> -">trans('Delete'); ?> - + if ($user->rights->adherent->supprimer) { + echo ''.$langs->trans('Delete').''; + } -

-
'; +} echo $this->control->tpl['actionstodo']; echo $this->control->tpl['actionsdone']; -?> - +echo "\n"; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 06053127c9a..8478288ba69 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -866,18 +866,18 @@ else $object->country_code=$tmparray['code']; $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; -} - } + 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); @@ -983,7 +983,7 @@ if (! ($object->id > 0)) print ''; // EMail - print ''.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').''; + print ''.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').''; // Address print ''.$langs->trans("Address").''; @@ -1020,13 +1020,13 @@ if (! ($object->id > 0)) } // Pro phone - print ''.$langs->trans("PhonePro").''; + print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").''; // Personal phone - print ''.$langs->trans("PhonePerso").''; + print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").''; // Mobile phone - print ''.$langs->trans("PhoneMobile").''; + print ''.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").''; // Skype if (! empty($conf->socialnetworks->enabled)) @@ -1259,7 +1259,7 @@ if (! ($object->id > 0)) print ''; // EMail - print ''.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">'; + print ''.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">'; // Address print ''.$langs->trans("Address").''; @@ -1289,13 +1289,13 @@ if (! ($object->id > 0)) } // Pro phone - print ''.$langs->trans("PhonePro").'phone).'">'; + print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'phone).'">'; // Personal phone - print ''.$langs->trans("PhonePerso").'phone_perso).'">'; + print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'phone_perso).'">'; // Mobile phone - print ''.$langs->trans("PhoneMobile").'phone_mobile).'">'; + print ''.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'phone_mobile).'">'; // Skype if (! empty($conf->socialnetworks->enabled)) @@ -1679,14 +1679,14 @@ if (! ($object->id > 0)) else { if ($object->need_subscription == 0) - { - print $langs->trans("SubscriptionNotNeeded"); + { + print $langs->trans("SubscriptionNotNeeded"); } - elseif (! $adht->subscription) + elseif (! $adht->subscription) { 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 - } + } else { print $langs->trans("SubscriptionNotReceived"); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 14eb401866a..e30b82aee5f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1282,7 +1282,7 @@ class Adherent extends CommonObject $this->societe = $obj->company; $this->company = $obj->company; $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->zip = $obj->zip; $this->town = $obj->town; @@ -2132,7 +2132,11 @@ class Adherent extends CommonObject // Only picto if ($withpictoimg > 0) $picto=''.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).''; // Picto must be a photo - else $picto=''.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).''; + else { + $picto=''; + $picto.=Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1); + $picto.=''; + } $result.=$picto; } if ($withpictoimg > -2 && $withpictoimg != 2) @@ -2175,83 +2179,46 @@ class Adherent extends CommonObject // phpcs:enable global $langs; $langs->load("members"); - if ($mode == 0) + + if ($statut == -1) { - if ($statut == -1) return $langs->trans("MemberStatusDraft"); - elseif ($statut >= 1) { - if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription"); - elseif (! $date_end_subscription) return $langs->trans("MemberStatusActive"); - elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate"); - else return $langs->trans("MemberStatusPaid"); - } - elseif ($statut == 0) return $langs->trans("MemberStatusResiliated"); + $statusType = 'status0'; + $labelstatut = $langs->trans("MemberStatusDraft"); + $labelstatutShort = $langs->trans("MemberStatusDraftShort"); } - elseif ($mode == 1) + elseif ($statut >= 1) { + if ($need_subscription == 0) + { + $statusType = 'status4'; + $labelstatut = $langs->trans("MemberStatusNoSubscription"); + $labelstatutShort = $langs->trans("MemberStatusNoSubscriptionShort"); + } + elseif (! $date_end_subscription) + { + $statusType = 'status1'; + $labelstatut = $langs->trans("MemberStatusActive"); + $labelstatutShort = $langs->trans("MemberStatusActiveShort"); + } + elseif ($date_end_subscription < time()) + { + $statusType = 'status3'; + $labelstatut = $langs->trans("MemberStatusActiveLate"); + $labelstatutShort = $langs->trans("MemberStatusActiveLateShort"); + } + else { + $statusType = 'status4'; + $labelstatut = $langs->trans("MemberStatusPaid"); + $labelstatutShort = $langs->trans("MemberStatusPaidShort"); + } + } + elseif ($statut == 0) { - if ($statut == -1) return $langs->trans("MemberStatusDraftShort"); - elseif ($statut >= 1) { - if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription"); - elseif (! $date_end_subscription) return $langs->trans("MemberStatusActiveShort"); - elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLateShort"); - else return $langs->trans("MemberStatusPaidShort"); - } - elseif ($statut == 0) return $langs->trans("MemberStatusResiliatedShort"); - } - elseif ($mode == 2) - { - if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0').' '.$langs->trans("MemberStatusDraftShort"); - elseif ($statut >= 1) { - if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4').' '.$langs->trans("MemberStatusNoSubscriptionShort"); - elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1').' '.$langs->trans("MemberStatusActiveShort"); - elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3').' '.$langs->trans("MemberStatusActiveLateShort"); - else return img_picto($langs->trans('MemberStatusPaid'), 'statut4').' '.$langs->trans("MemberStatusPaidShort"); - } - elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); - } - elseif ($mode == 3) - { - if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0'); - elseif ($statut >= 1) { - if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4'); - elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1'); - elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3'); - else return img_picto($langs->trans('MemberStatusPaid'), 'statut4'); - } - elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5'); - } - elseif ($mode == 4) - { - if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0').' '.$langs->trans("MemberStatusDraft"); - elseif ($statut >= 1) { - if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4').' '.$langs->trans("MemberStatusNoSubscription"); - elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1').' '.$langs->trans("MemberStatusActive"); - elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3').' '.$langs->trans("MemberStatusActiveLate"); - else return img_picto($langs->trans('MemberStatusPaid'), 'statut4').' '.$langs->trans("MemberStatusPaid"); - } - if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5').' '.$langs->trans("MemberStatusResiliated"); - } - elseif ($mode == 5) - { - if ($statut == -1) return ''.$langs->trans("MemberStatusDraftShort").' '.img_picto($langs->trans('MemberStatusDraft'), 'statut0'); - elseif ($statut >= 1) { - if ($need_subscription == 0) return ''.$langs->trans("MemberStatusNoSubscriptionShort").' '.img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4'); - elseif (! $date_end_subscription) return ''.$langs->trans("MemberStatusActiveShort").' '.img_picto($langs->trans('MemberStatusActive'), 'statut1'); - elseif ($date_end_subscription < time()) return ''.$langs->trans("MemberStatusActiveLateShort").' '.img_picto($langs->trans('MemberStatusActiveLate'), 'statut3'); - else return ''.$langs->trans("MemberStatusPaidShort").' '.img_picto($langs->trans('MemberStatusPaid'), 'statut4'); - } - if ($statut == 0) return ''.$langs->trans("MemberStatusResiliated").' '.img_picto($langs->trans('MemberStatusResiliated'), 'statut5'); - } - elseif ($mode == 6) - { - if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'), 'statut0'); - if ($statut >= 1) { - if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription").' '.img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4'); - elseif (! $date_end_subscription) return $langs->trans("MemberStatusActive").' '.img_picto($langs->trans('MemberStatusActive'), 'statut1'); - elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate").' '.img_picto($langs->trans('MemberStatusActiveLate'), 'statut3'); - else return $langs->trans("MemberStatusPaid").' '.img_picto($langs->trans('MemberStatusPaid'), 'statut4'); - } - if ($statut == 0) return $langs->trans("MemberStatusResiliated").' '.img_picto($langs->trans('MemberStatusResiliated'), 'statut5'); + $statusType = 'status6'; + $labelstatut = $langs->trans("MemberStatusResiliated"); + $labelstatutShort = $langs->trans("MemberStatusResiliatedShort"); } + + return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode); } @@ -2370,7 +2337,6 @@ class Adherent extends CommonObject $langs->load("orders"); if (! dol_strlen($modele)) { - $modele = 'standard'; if ($this->modelpdf) { @@ -2472,7 +2438,7 @@ class Adherent extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore - /** + /** * Initialise tableau info (tableau des attributs LDAP) * * @return array Tableau info des attributs diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index a57a90a3aac..b4bdb119b29 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -88,8 +88,8 @@ class AdherentType extends CommonObject /** @var array Array of members */ public $members=array(); - - public $multilangs=array(); + + public $multilangs=array(); /** @@ -129,9 +129,9 @@ class AdherentType extends CommonObject $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; + $this->multilangs["$obj->lang"]["label"] = $obj->label; + $this->multilangs["$obj->lang"]["description"] = $obj->description; + $this->multilangs["$obj->lang"]["email"] = $obj->email; } return 1; } @@ -141,7 +141,7 @@ class AdherentType extends CommonObject return -1; } } - + /** * Update or add a translation for a product * @@ -248,7 +248,7 @@ class AdherentType extends CommonObject return 1; } - + /** * Delete a language for this product * @@ -361,7 +361,7 @@ class AdherentType extends CommonObject */ public function update($user, $notrigger = 0) { - global $langs, $conf, $hookmanager; + global $langs, $conf, $hookmanager; $error=0; @@ -383,17 +383,16 @@ class AdherentType extends CommonObject $result = $this->db->query($sql); if ($result) { - - $this->description = $this->db->escape($this->note); + $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; - } + // 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'; // Actions on extra fields @@ -475,8 +474,8 @@ class AdherentType extends CommonObject */ public function fetch($rowid) { - global $langs, $conf; - + 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 .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.rowid = ".(int) $rowid; @@ -499,11 +498,11 @@ class AdherentType extends CommonObject $this->mail_valid = $obj->mail_valid; $this->note = $obj->note; $this->vote = $obj->vote; - - // multilangs - if (! empty($conf->global->MAIN_MULTILANGS)) { - $this->getMultiLangs(); - } + + // multilangs + if (! empty($conf->global->MAIN_MULTILANGS)) { + $this->getMultiLangs(); + } } return 1; diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 092827ef731..a6343596632 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -90,7 +90,6 @@ if ($id > 0) $result=$membert->fetch($object->typeid); if ($result > 0) { - // Build file list $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1); $totalsize=0; diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index b858693255e..f8f21d2868a 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -227,10 +227,8 @@ $sql = "SELECT c.subscription, c.dateadh as dateh"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; $sql.= " WHERE d.entity IN (".getEntity('adherent').")"; $sql.= " AND d.rowid = c.fk_adherent"; -if(isset($date_select) && $date_select != '') -{ - $sql .= " AND c.dateadh LIKE '".$date_select."%'"; -} + + $result = $db->query($sql); if ($result) { @@ -251,21 +249,33 @@ if ($result) print '
'; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print ''; print ''; print "\n"; krsort($Total); +$i = 0; foreach ($Total as $key=>$value) { - print ''; + if ($i >= 8) + { + print ''; + print ""; + print ""; + print ""; + print ""; + print "\n"; + break; + } + print ''; print ""; print ""; print ""; print ""; print "\n"; + $i++; } // Total diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 877dde34af0..0bcc11bf351 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -681,6 +681,7 @@ while ($i < min($num, $limit)) $memberstatic->datefin= $datefin; $memberstatic->socid = $obj->fk_soc; $memberstatic->photo = $obj->photo; + $memberstatic->morphy = $obj->morphy; if (! empty($obj->fk_soc)) { $memberstatic->fetch_thirdparty(); diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index 4334a54605b..accf7de07b6 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -24,11 +24,7 @@ if (empty($conf) || ! is_object($conf)) exit; } -?> - - - -\n"; global $user; @@ -39,23 +35,20 @@ $langs->load("members"); $total=0; foreach($linkedObjectBlock as $key => $objectlink) { - -?> - - - - - - '; + echo ''; + echo ''; + echo ''; + echo ' - - - -'; + echo ''; + echo ''; + echo ''; } -?> - +echo "\n"; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index b24e3361d16..94978e7f8a9 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -94,7 +94,6 @@ $hookmanager->initHooks(array('membertypecard','globalcard')); */ if ($cancel) { - $action=''; if (! empty($backtopage)) { @@ -524,14 +523,14 @@ if ($rowid > 0) { $sql.= natural_search("d.email", $search_email); } - if ($filter == 'uptodate') - { - $sql.=" AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)"; - } - if ($filter == 'outofdate') - { - $sql.=" AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; - } + if ($filter == 'uptodate') + { + $sql.=" AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)"; + } + if ($filter == 'outofdate') + { + $sql.=" AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; + } $sql.= " ".$db->order($sortfield, $sortorder); diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 5122bebcecf..ac9a269bf29 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -295,7 +295,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) print '
'.$langs->trans("Subscriptions").''.$langs->trans("Number").''.$langs->trans("Year").''.$langs->trans("Subscriptions").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
...
$key".$Number[$key]."".price($value)."".price(price2num($value/$Number[$key], 'MT'))."
trans("Subscription"); ?>getNomUrl(1); ?>dateh, 'day'); ?>'; + echo ''.$langs->trans("Subscription").''.$objectlink->getNomUrl(1).''.dol_print_date($objectlink->dateh, 'day').''; if ($user->rights->adherent->lire) { $total = $total + $objectlink->amount; echo price($objectlink->amount); - } ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'
'; print ''; print ''; print '
'.$langs->trans('Language').''; - print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1); + print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1); print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index cba3fd822cc..bfde50618cc 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -93,158 +93,87 @@ $countrynotdefined=''.$langs->trans("ErrorSetACountryFirst") print ''.$langs->trans("AccountantDesc")."
\n"; print "
\n"; -if ($action == 'edit' || $action == 'updateedit') -{ - /** - * Edit parameters - */ - print "\n".''."\n"; +/** + * Edit parameters + */ +print "\n".''."\n"; - print ''; - print ''; - print ''; +print ''; +print ''; +print ''; - print ''; - print ''."\n"; +print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; +print ''."\n"; - // Name - print ''."\n"; +// Name +print ''."\n"; - // Address - print ''."\n"; +// Address +print ''."\n"; - print ''."\n"; +print ''."\n"; - print ''."\n"; +print ''."\n"; - // Country - print ''."\n"; +// Country +print ''."\n"; - print ''."\n"; +print ''."\n"; - print ''; - print ''."\n"; +print ''; +print ''."\n"; - print ''; - print ''."\n"; +print ''; +print ''."\n"; - print ''; - print ''."\n"; +print ''; +print ''."\n"; - // Web - print ''; - print ''."\n"; +// Web +print ''; +print ''."\n"; - // Code - print ''."\n"; +// Code +print ''."\n"; - // Note - print ''; - print ''; +// Note +print ''; +print ''; - print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; - print '
'; +print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>
'; - print '
'; +print '
'; - print '
'; +print '
'; - print '
'; +print '
'; - //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'); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print '
'; +//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'); +if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); +print '
'; - $formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id'); - print '
'; +$formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id'); +print '
'; - print '
'; +print '
'; - print '
'; +print '
'; - print '
'; +print '
'; - print '
'; +print '
'; - print '
'; +print '
'; - print '
'; +print '
'; +print '
'; - print '
'; - print ''; - print '     '; - print ''; - print '
'; - print '
'; +print '
'; +print ''; +//print '     '; +//print ''; +print '
'; +//print '
'; - print ''; -} -else -{ - /* - * Show parameters - */ +print ''; - // Actions buttons - //print '
'; - //print ''.$langs->trans("Modify").''; - //print '

'; - - print '
'; - print ''; - print ''; - - - print ''; - - - print ''; - - - print ''; - - - print ''; - - - print ''; - - - if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyName").''; - print $conf->global->MAIN_INFO_ACCOUNTANT_NAME; - print '
'.$langs->trans("CompanyAddress").'' . nl2br(empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) . '
'.$langs->trans("CompanyZip").'' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ZIP) . '
'.$langs->trans("CompanyTown").'' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN)?'':$conf->global->MAIN_INFO_ACCOUNTANT_TOWN) . '
'.$langs->trans("CompanyCountry").''; - 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 '
'.$langs->trans("Region-State").''; - else print '
'.$langs->trans("State").''; - 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 ' '; - print '
'.$langs->trans("Phone").'' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_PHONE, $mysoc->country_code) . '
'.$langs->trans("Fax").'' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_FAX, $mysoc->country_code) . '
'.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_ACCOUNTANT_MAIL, 0, 0, 0, 80) . '
'.$langs->trans("Web").'' . dol_print_url($conf->global->MAIN_INFO_ACCOUNTANT_WEB, '_blank', 80) . '
'.$langs->trans("AccountantFileNumber").'' . $conf->global->MAIN_INFO_ACCOUNTANT_CODE . '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) ? nl2br($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) : '') . '
'; - print "
"; - - print ''; - - // Actions buttons - print '
'; - print ''; - print '
'; -} llxFooter(); diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index a13b7bd1580..beccc9e9d5a 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -268,18 +268,17 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // Active if (in_array($name, $def)) { - - print ''."\n"; - if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") - { - print 'scandir.'&label='.urlencode($module->name).'&type=action">'; - print img_picto($langs->trans("Enabled"), 'switch_on'); - print ''; - } - else - { - print img_picto($langs->trans("Enabled"), 'switch_on'); - } + print ''."\n"; + if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") + { + print 'scandir.'&label='.urlencode($module->name).'&type=action">'; + print img_picto($langs->trans("Enabled"), 'switch_on'); + print ''; + } + else + { + print img_picto($langs->trans("Enabled"), 'switch_on'); + } print ""; } else @@ -363,7 +362,6 @@ print ''."\n"; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''; print ''."\n"; print ''.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").''."\n"; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 689202c023d..70b273e2fcc 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -253,7 +253,6 @@ $i = 0; $nbofbank = count($bankorder); while ($i < $nbofbank) { - print ''; print '' . $bankorder[$i][0] . "\n"; print $bankorder[$i][1]; @@ -341,7 +340,6 @@ foreach ($dirmodels as $reldir) { foreach ($filelist as $file) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir . '/' . $file)) { $name = substr($file, 4, dol_strlen($file) - 16); $classname = substr($file, 0, dol_strlen($file) - 12); diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 0475cdfccf1..57031a9822f 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -96,29 +96,29 @@ elseif ($action == 'updateengine') $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - while ($i < $num) - { - $obj = $db->fetch_object($resql); + while ($i < $num) + { + $obj = $db->fetch_object($resql); - if (GETPOST('coder'.$obj->rowid, 'alpha')) - { - $coder = GETPOST('coder'.$obj->rowid, 'alpha'); - $code_id = $obj->rowid; + if (GETPOST('coder'.$obj->rowid, 'alpha')) + { + $coder = GETPOST('coder'.$obj->rowid, 'alpha'); + $code_id = $obj->rowid; - $sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type"; - $sqlp.= " SET coder = '" . $coder."'"; - $sqlp.= " WHERE rowid = ". $code_id; - $sqlp.= " AND entity = ".$conf->entity; + $sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type"; + $sqlp.= " SET coder = '" . $coder."'"; + $sqlp.= " WHERE rowid = ". $code_id; + $sqlp.= " AND entity = ".$conf->entity; - $upsql=$db->query($sqlp); - if (! $upsql) dol_print_error($db); - } + $upsql=$db->query($sqlp); + if (! $upsql) dol_print_error($db); + } - $i++; - } + $i++; + } } } @@ -319,7 +319,6 @@ print ''; // Chemin du binaire genbarcode sous linux if (! isset($_SERVER['WINDIR'])) { - print ''; print ''.$langs->trans("GenbarcodeLocation").''; print ''; @@ -335,7 +334,6 @@ if (! isset($_SERVER['WINDIR'])) // Module products if (! empty($conf->product->enabled)) { - print ''; print ''.$langs->trans("SetDefaultBarcodeTypeProducts").''; print ''; @@ -346,7 +344,6 @@ if (! empty($conf->product->enabled)) // Module thirdparty if (! empty($conf->societe->enabled)) { - print ''; print ''.$langs->trans("SetDefaultBarcodeTypeThirdParties").''; print ''; diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index e5e12d41808..26ea1b12a29 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -255,7 +255,6 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - print ''.$module->name."\n"; print $module->info(); print ''; @@ -381,7 +380,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); @@ -432,7 +430,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 58c07b5ca3e..1e158bc7a7f 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -222,7 +222,7 @@ llxHeader('', $langs->trans("Boxes")); print load_fiche_titre($langs->trans("Boxes"), '', 'title_setup'); -print $langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."
\n"; +print ''.$langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."
\n"; /* * Search for the default active boxes for each possible position @@ -474,7 +474,6 @@ print ''; // Activate FileCache - Developement if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { - print ''.$langs->trans("EnableFileCache").''; print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1); print ''; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index cb07d741a06..10955b5e8bd 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -282,7 +282,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) { 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()) { - print ''.$module->name."\n"; print $module->info(); print ''; @@ -423,7 +421,6 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); @@ -473,7 +470,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index a3534d3bc5a..09a4e95c0ae 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -105,69 +105,79 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alpha'), 'chaine', 0, '', $conf->entity); - $varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/'; - if ($_FILES[$varforimage]["tmp_name"]) + $dirforimage=$conf->mycompany->dir_output.'/logos/'; + + $arrayofimages = array('logo', 'logo_squarred'); + + foreach($arrayofimages as $varforimage) { - if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) + if ($_FILES[$varforimage]["tmp_name"]) { - $original_file=$reg[1]; - - $isimage=image_format_supported($original_file); - if ($isimage >= 0) + $reg = array(); + if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) { - dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file); - if (! is_dir($dirforimage)) - { - dol_mkdir($dirforimage); - } - $result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']); - if ($result > 0) - { - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO", $original_file, 'chaine', 0, '', $conf->entity); + $original_file=$reg[1]; - // Create thumbs of logo (Note that PDF use original file and not thumbs) - if ($isimage > 0) + $isimage=image_format_supported($original_file); + if ($isimage >= 0) + { + dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file); + if (! is_dir($dirforimage)) { - // Create thumbs - //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... - - // Create small thumb, Used on logon for example - $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); - if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) - { - $imgThumbSmall = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); - } - else dol_syslog($imgThumbSmall); - - // Create mini thumb, Used on menu or for setup page for example - $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); - if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) - { - $imgThumbMini = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); - } - else dol_syslog($imgThumbMini); + dol_mkdir($dirforimage); + } + $result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']); + if ($result > 0) + { + $constant = "MAIN_INFO_SOCIETE_LOGO"; + if ($varforimage == 'logo_squarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; + + dolibarr_set_const($db, $constant, $original_file, 'chaine', 0, '', $conf->entity); + + // Create thumbs of logo (Note that PDF use original file and not thumbs) + if ($isimage > 0) + { + // Create thumbs + //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... + + // Create small thumb, Used on logon for example + $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); + if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) + { + $imgThumbSmall = $reg[1]; // Save only basename + dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); + } + else dol_syslog($imgThumbSmall); + + // Create mini thumb, Used on menu or for setup page for example + $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); + if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) + { + $imgThumbMini = $reg[1]; // Save only basename + dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); + } + else dol_syslog($imgThumbMini); + } + else dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING); + } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { + $error++; + $langs->load("errors"); + $tmparray=explode(':', $result); + setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); + } + else + { + $error++; + setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); } - else dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING); - } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { - $error++; - $langs->load("errors"); - $tmparray=explode(':', $result); - setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); } else { $error++; - setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + $langs->load("errors"); + setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); } } - else - { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); - } } } @@ -247,7 +257,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) } } -if ($action == 'addthumb') // Regenerate thumbs +if ($action == 'addthumb' || $action == 'addthumbsquarred') // Regenerate thumbs { if (file_exists($conf->mycompany->dir_output.'/logos/'.$_GET["file"])) { @@ -256,15 +266,20 @@ if ($action == 'addthumb') // Regenerate thumbs // Create thumbs of logo if ($isimage > 0) { + $constant = "MAIN_INFO_SOCIETE_LOGO"; + if ($action == 'addthumbsquarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; + + $reg = array(); + // Create thumbs - //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... + //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... // Create small thumb. Used on logon for example $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small', $quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) { $imgThumbSmall = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); } else dol_syslog($imgThumbSmall); @@ -273,7 +288,7 @@ if ($action == 'addthumb') // Regenerate thumbs if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) { $imgThumbMini = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); } else dol_syslog($imgThumbMini); @@ -297,24 +312,55 @@ if ($action == 'addthumb') // Regenerate thumbs } } -if ($action == 'removelogo') + +if ($action == 'removelogo' || $action == 'removelogosquarred') { + $constant = "MAIN_INFO_SOCIETE_LOGO"; + if ($action == 'removelogosquarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $logofile=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; - if ($mysoc->logo != '') dol_delete_file($logofile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO", $conf->entity); - $mysoc->logo=''; + $logofilename = $mysoc->logo; + $logofilenamebis = $mysoc->logo_squarred; + if ($action == 'removelogosquarred') + { + $logofilename = $mysoc->logo_squarred; + $logofilenamebis = $mysoc->logo; + } - $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small; - if ($mysoc->logo_small != '') dol_delete_file($logosmallfile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $conf->entity); - $mysoc->logo_small=''; + $logofile=$conf->mycompany->dir_output.'/logos/'.$logofilename; + if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logofile); + dolibarr_del_const($db, $constant, $conf->entity); + if ($action == 'removelogosquarred') $mysoc->logo_squarred=''; + else $mysoc->logo=''; - $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini; - if ($mysoc->logo_mini != '') dol_delete_file($logominifile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $conf->entity); - $mysoc->logo_mini=''; + $logofilename = $mysoc->logo_small; + $logofilenamebis = $mysoc->logo_squarred_small; + if ($action == 'removelogosquarred') + { + $logofilename = $mysoc->logo_squarred_small; + $logofilenamebis = $mysoc->logo_small; + } + + $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename; + if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logosmallfile); + dolibarr_del_const($db, $constant."_SMALL", $conf->entity); + if ($action == 'removelogosquarred') $mysoc->logo_squarred_small=''; + else $mysoc->logo_small=''; + + $logofilename = $mysoc->logo_mini; + $logofilenamebis = $mysoc->logo_squarred_mini; + if ($action == 'removelogosquarred') + { + $logofilename = $mysoc->logo_squarred_mini; + $logofilenamebis = $mysoc->logo_mini; + } + + $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename; + if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logominifile); + dolibarr_del_const($db, $constant."_MINI", $conf->entity); + if ($action == 'removelogosquarred') $mysoc->logo_squarred_mini=''; + else $mysoc->logo_mini=''; } @@ -337,875 +383,416 @@ $head = company_admin_prepare_head(); dol_fiche_head($head, 'company', $langs->trans("Company"), -1, 'company'); -print ''.$langs->trans("CompanyFundationDesc", $langs->transnoentities("Modify"), $langs->transnoentities("Save"))."
\n"; +print ''.$langs->trans("CompanyFundationDesc", $langs->transnoentities("Save"))."
\n"; print "
\n"; -if ($action == 'edit' || $action == 'updateedit') + +/** + * Edit parameters + */ +print "\n".''."\n"; + +print '
'; +print ''; +print ''; + +print ''; +print ''."\n"; + +// Name + +print ''."\n"; + +// Addresse + +print ''."\n"; + + +print ''."\n"; + + +print ''."\n"; + +// Country + +print ''."\n"; + + +print ''; +// Fiscal year start +print '
'; +print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; +print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>
'; +print '
'; +print '
'; +print '
'; +//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization +print $form->select_country($mysoc->country_id, 'country_id'); +if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); +print '
'; +$state_id=0; +if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) { - /** - * Edition des parametres - */ - print "\n".''."\n"; - - print ''; - print ''; - print ''; - - print ''; - print ''."\n"; - - // Name - - print ''."\n"; - - // Addresse - - print ''."\n"; + $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE); + $state_id=$tmp[0]; +} +$formcompany->select_departement($state_id, $mysoc->country_code, 'state_id'); +print ''."\n"; - print ''."\n"; +print ''."\n"; - print ''."\n"; - - // Country - - print ''."\n"; +print ''; +print ''."\n"; - print ''; +print ''."\n"; + + +print ''; +print ''."\n"; + +// Web +print ''; +print ''."\n"; + +// Barcode +if (! empty($conf->barcode->enabled)) { + print ''; + print ''; +} + +// Logo +print ''; + +// Logo (squarred) +print ''; + +// Note +print ''; +print ''; + +print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; - print '
'; - print '
'; - print '
'; +print $form->selectCurrency($conf->currency, "currency"); +print '
'; - print '
'; - //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization - print $form->select_country($mysoc->country_id, 'country_id'); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print '
'; +print '
'; - $state_id=0; - if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) +print '
'; +print '
'; +print '
'; +print '
'; + print '
'; +print '
'; +print ''; +print ''; +if (! empty($mysoc->logo_mini)) { + print ''.img_delete($langs->trans("Delete")).''; + if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { + print '   '; + print ''; + } +} else { + print ''; +} +print '
'; +print '
'; +print '
'; +print ''; +print ''; +if (! empty($mysoc->logo_squarred_mini)) { + print ''.img_delete($langs->trans("Delete")).''; + if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { + print '   '; + print ''; + } +} else { + print ''; +} +print '
'; +print '
'; +print '
'; + +print '
'; + +// IDs of the company (country-specific) +print ''; +print ''; + +$langs->load("companies"); + +// Managing Director(s) + +print ''; + +// GDPR contact + +print ''; + +// Capital + +print ''; + +// Juridical Status + +print ''; + +// ProfID1 +if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') +{ + print ''."\n"; - - - print ''."\n"; - - - print ''; - print ''."\n"; - - - print ''; - print ''."\n"; - - - print ''; - print ''."\n"; - - // Web - print ''; - print ''."\n"; - - // Barcode - if (! empty($conf->barcode->enabled)) { - - print ''; - print ''; - } - - // Logo - print ''; - - // Note - print ''; - print ''; - - print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'; +print '
'; +print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc")); +print ''; +print '
'; +print '
'; +if ($mysoc->country_code) { + print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code'); +} else { + print $countrynotdefined; +} +print '
'; + if (! empty($mysoc->country_code)) { - $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE); - $state_id=$tmp[0]; + print ''; } - $formcompany->select_departement($state_id, $mysoc->country_code, 'state_id'); - print '
'; - print $form->selectCurrency($conf->currency, "currency"); - print '
'; - print '
'; - print '
'; - print '
'; - print '
'; - print '
'; - print '
'; - print ''; - print ''; - if (! empty($mysoc->logo_mini)) { - print ''.img_delete($langs->trans("Delete")).''; - if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { - print '   '; - print ''; - } - } else { - print ''; - } - print '
'; - print '
'; - print '
'; - - print '
'; - - // IDs of the company (country-specific) - print ''; - print ''; - - $langs->load("companies"); - - // Managing Director(s) - - print ''; - - // GDPR contact - - print ''; - - // Capital - - print ''; - - // Juridical Status - - print ''; - - // ProfID1 - if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId2 - if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId3 - if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId4 - if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId5 - if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId6 - if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') - { - - print ''; - } - - // TVA Intra - - print ''; - - // Object of the company - - print ''; - print ''; - - print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'; - print '
'; - print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc")); - print ''; - print '
'; - print '
'; - if ($mysoc->country_code) { - print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code'); - } else { + else + { print $countrynotdefined; } print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - if (! empty($mysoc->country_code)) - { - print ''; - } - else - { - print $countrynotdefined; - } - print '
'; - print ''; - print '
'; - print '
'; - - - // Fiscal year start - print '
'; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - - print "
'.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").'
'; - print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100') . '
"; - - - // Fiscal options - print '
'; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - - print ""; - print '\n"; - - - print ""; - print '\n"; - - print "
'.$langs->trans("VATManagement").''.$langs->trans("Description").' 
'; - print ""; - print ""; - if ($mysoc->country_code == 'FR') print "\n"; - print "
".$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."
"; - print "
'; - print ""; - print ""; - if ($mysoc->country_code == 'FR') print "\n"; - print "
".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."
"; - print "
"; - - /* - * Local Taxes - */ - if ($mysoc->useLocalTax(1)) - { - // Local Tax 1 - print '
'; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - // Note: When option is not set, it must not appears as set on on, because there is no default value for this option - print ""; - print '\n"; - - - print ""; - print '\n"; - print "
'.$langs->transcountry("LocalTax1Management", $mysoc->country_code).''.$langs->trans("Description").' 
global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."'; - print ''; - print ""; - $example=$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); - print ($example!="LocalTax1IsUsedExample"?"\n":""); - if(! isOnlyOneLocalTax(1)) - { - print ''; - } - - $opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc")); - - print ''; - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."
: '; - $formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1"); - print '
'.$langs->trans("CalcLocaltax").': '; - print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1); - print '
"; - print "
global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code); - print ($example!="LocalTax1IsNotUsedExample"?"\n":""); - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."
"; - print "
"; - } - if ($mysoc->useLocalTax(2)) - { - // Local Tax 2 - print '
'; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - - // Note: When option is not set, it must not appears as set on on, because there is no default value for this option - print ""; - print '\n"; - - - print ""; - print '\n"; - print "
'.$langs->transcountry("LocalTax2Management", $mysoc->country_code).''.$langs->trans("Description").' 
global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."'; - print ''; - print ""; - $example=$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code); - print ($example!="LocalTax2IsUsedExample"?"\n":""); - if(! isOnlyOneLocalTax(2)) - { - print ''; - } - print ''; - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."
: '; - $formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2"); - print '
: '; - print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2); - print '
"; - print "
global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code); - print ($example!="LocalTax2IsNotUsedExample"?"\n":""); - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."
"; - print "
"; - } - - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - print '
'; - - print ''; } -else + +// ProfId2 +if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') { - /* - * Show parameters - */ - - // Actions buttons - //print '
'; - //print ''.$langs->trans("Modify").''; - //print '

'; - - print '
'; - print ''; - print ''; - - - print ''; - - - print ''; - - - print ''; - - - print ''; - - - print ''; - - - if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print ''; - - - print ''; - - - print ''; - - - print ''; - - - print ''; - - // Web - - print ''; - - // Barcode - - if (! empty($conf->barcode->enabled)) - { - print ''; - } - - // Logo - - print ''; +} - - print ''; - - print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyName").''; - if (! empty($conf->global->MAIN_INFO_SOCIETE_NOM)) print $conf->global->MAIN_INFO_SOCIETE_NOM; - else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyName")).''; - print '
'.$langs->trans("CompanyAddress").'' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS) . '
'.$langs->trans("CompanyZip").'' . (empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP) . '
'.$langs->trans("CompanyTown").'' . (empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN) . '
'.$langs->trans("CompanyCountry").''; - if ($mysoc->country_code) + print '
'; + if (! empty($mysoc->country_code)) { - $img=picto_from_langcode($mysoc->country_code); - print $img?$img.' ':''; - print getCountry($mysoc->country_code, 1); - } - else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - print '
'.$langs->trans("Region-State").''; - else print '
'.$langs->trans("State").''; - if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) - { - $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE); - $state_id=$tmp[0]; - print getState($state_id, $conf->global->MAIN_SHOW_STATE_CODE, 0, $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT); - } - print '
'.$langs->trans("CompanyCurrency").''; - print currency_name($conf->currency, 0); - print ' ('.$conf->currency; - print ($conf->currency != $langs->getCurrencySymbol($conf->currency) ? ' - '.$langs->getCurrencySymbol($conf->currency) : ''); - print ')'; - print ' - '.$langs->trans("PriceFormatInCurrentLanguage", $langs->defaultlang).' : '.price(price2num('99.333333333', 'MT'), 1, $langs, 1, -1, -1, $conf->currency); - print '
'.$langs->trans("Phone").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL, $mysoc->country_code) . '
'.$langs->trans("Fax").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX, $mysoc->country_code) . '
'.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL, 0, 0, 0, 80) . '
'.$langs->trans("Web").''; - $arrayofurl = preg_split('/\s/', $conf->global->MAIN_INFO_SOCIETE_WEB); - foreach($arrayofurl as $urltoshow) - { - if ($urltoshow) print dol_print_url($urltoshow, '_blank', 80); - } - print '
'.$langs->trans("Gencod").'' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '
'.$langs->trans("Logo").''; - - $tagtd='tagtd '; - if ($conf->browser->layout == 'phone') $tagtd=''; - print '
'; - print $mysoc->logo; - print '
'; - - // It offers the generation of the thumbnail if it does not exist - if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i', $mysoc->logo)) - { - print '  '; - } - elseif ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - print ''; + print ''; } else { - print ''; + print $countrynotdefined; } - print '
'; - print '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '
'; - print "
"; - - print '
'; - - - // IDs of the company (country-specific) - print '
'; - print ''; - - print '
'; - print ''; - print ''; - - // Managing Director(s) - - print ''; - - // GDPR Contact - - print ''; - - // Capital - - print ''; - - // Juridical Status - - print ''; - - // ProfId1 - if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') +// ProfId3 +if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') +{ + print ''; - } - - // ProfId2 - if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId3 - if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId4 - if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId5 - if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') - { - - print ''; - } - - // ProfId6 - if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') - { - - print ''; - } - - // VAT - - print ''; - print ''; - print ''; + print ''; +} + +// ProfId4 +if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') +{ + print ''; +} + +// ProfId5 +if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') +{ + print ''; +} + +// ProfId6 +if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') +{ + print ''; +} + +// TVA Intra + +print ''; + +// Object of the company + +print ''; +print ''; + +print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'.$langs->trans("ManagingDirectors").''; - print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '
'.$langs->trans("GDPRContact").''; - print $conf->global->MAIN_INFO_GDPR . '
'.$langs->trans("Capital").''; - print $conf->global->MAIN_INFO_CAPITAL . '
'.$langs->trans("JuridicalStatus").''; - print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); - print '
'; + if (! empty($mysoc->country_code)) { - - print '
'.$langs->transcountry("ProfId1", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_SIREN)) - { - print $conf->global->MAIN_INFO_SIREN; - $s = $mysoc->id_prof_url(1, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->transcountry("ProfId2", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_SIRET)) - { - print $conf->global->MAIN_INFO_SIRET; - $s = $mysoc->id_prof_url(2, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->transcountry("ProfId3", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_APE)) - { - print $conf->global->MAIN_INFO_APE; - $s = $mysoc->id_prof_url(3, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->transcountry("ProfId4", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_RCS)) - { - print $conf->global->MAIN_INFO_RCS; - $s = $mysoc->id_prof_url(4, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->transcountry("ProfId5", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_PROFID5)) - { - print $conf->global->MAIN_INFO_PROFID5; - $s = $mysoc->id_prof_url(5, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->transcountry("ProfId6", $mysoc->country_code).''; - if (! empty($conf->global->MAIN_INFO_PROFID6)) - { - print $conf->global->MAIN_INFO_PROFID6; - $s = $mysoc->id_prof_url(6, $mysoc); - if ($s) print ' - '.$s; - } else { - print ' '; - } - print '
'.$langs->trans("VATIntra").''; - if (! empty($conf->global->MAIN_INFO_TVAINTRA)) - { - $s=''; - $s.=$conf->global->MAIN_INFO_TVAINTRA; - $s.=''; - if (empty($conf->global->MAIN_DISABLEVATCHECK) && $mysoc->isInEEC()) - { - $s.=' - '; - if (! empty($conf->use_javascript_ajax)) - { - print "\n"; - print ''; - print "\n"; - $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); - } - else - { - $s.='id_country).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; - } - } - print $s; + print ''; } else { - print ' '; + print $countrynotdefined; } - print '
'; + if (! empty($mysoc->country_code)) + { + print ''; + } + else + { + print $countrynotdefined; + } + print '
'; + if (! empty($mysoc->country_code)) + { + print ''; + } + else + { + print $countrynotdefined; + } + print '
'; + if (! empty($mysoc->country_code)) + { + print ''; + } + else + { + print $countrynotdefined; + } + print '
'; +print ''; +print '
'; +print '
'; - print '
'.$langs->trans("CompanyObject").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '
'; +print ''; +print ''; +print "\n"; - print '
'.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").'
'; - print "
"; +print ''; +print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100') . ''; - print ''; +print ""; - /* - * fiscal year beginning - */ + +// Fiscal options +print '
'; +print ''; +print ''; +print ''; +print ''; +print "\n"; + + +print ""; +print '\n"; + + +print ""; +print '\n"; + +print "
'.$langs->trans("VATManagement").''.$langs->trans("Description").' 
'; +print ""; +print ""; +if ($mysoc->country_code == 'FR') print "\n"; +print "
".$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."
"; +print "
'; +print ""; +print ""; +if ($mysoc->country_code == 'FR') print "\n"; +print "
".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."
"; +print "
"; + +/* + * Local Taxes + */ +if ($mysoc->useLocalTax(1)) +{ + // Local Tax 1 print '
'; - - print '
'; print ''; print ''; - print ''; + print ''; + print ''; print "\n"; + // Note: When option is not set, it must not appears as set on on, because there is no default value for this option + print ""; + print '\n"; - /* - * tax options - */ + + print ""; + print '\n"; + print "
'.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").''.$langs->transcountry("LocalTax1Management", $mysoc->country_code).''.$langs->trans("Description").' 
global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."'; + print ''; + print ""; + $example=$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); + print ($example!="LocalTax1IsUsedExample"?"\n":""); + if(! isOnlyOneLocalTax(1)) + { + print ''; + } - print ''; + $opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc")); + print ''; print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."
: '; + $formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1"); + print '
'.$langs->trans("FiscalMonthStart").''; - $monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1; - print dol_print_date(dol_mktime(12, 0, 0, $monthstart, 1, 2000, 1), '%B', 'gm') . '
'.$langs->trans("CalcLocaltax").': '; + print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1); + print '
"; - print ""; + print "
global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."'; + print ""; + print ""; + $example=$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code); + print ($example!="LocalTax1IsNotUsedExample"?"\n":""); + print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."
"; + print "
"; +} +if ($mysoc->useLocalTax(2)) +{ + // Local Tax 2 print '
'; - print '
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; - print '"; + // Note: When option is not set, it must not appears as set on on, because there is no default value for this option + print ""; print '\n"; - print '"; + print ""; print '\n"; - print "
'.$langs->trans("VATManagement").''.$langs->trans("Description").''.$langs->transcountry("LocalTax2Management", $mysoc->country_code).''.$langs->trans("Description").' 
'; - print "global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."
global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."'; - print ""; - print ""; - if ($mysoc->country_code == 'FR') print "\n"; + print '
".$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."
'; + print ""; + $example=$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code); + print ($example!="LocalTax2IsUsedExample"?"\n":""); + if(! isOnlyOneLocalTax(2)) + { + print ''; + } + print ''; print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."
: '; + $formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2"); + print '
: '; + print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2); + print '
"; print "
'; - print "global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."
global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."'; print ""; - print ""; - if ($mysoc->country_code == 'FR') print "\n"; + print ""; + $example=$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code); + print ($example!="LocalTax2IsNotUsedExample"?"\n":""); print "
".$langs->trans("VATIsNotUsedDesc")."
".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."
"; print "
"; - print "
"; - - /* - * Local Taxes - */ - if ($mysoc->useLocalTax(1)) // True if we found at least on vat with a setup adding a localtax 1 - { - // Local Tax 1 - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - - print ""; - print '\n"; - - - print '"; - print '\n"; - - print "
'.$langs->transcountry("LocalTax1Management", $mysoc->country_code).''.$langs->trans("Description").' 
"; - print "global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); - print ($example!="LocalTax1IsUsedExample"?"\n":""); - if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0) - { - print ''; - } - print ''; - print "
".$langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)."
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."
'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'
'.$langs->trans("CalcLocaltax").': '; - if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0) - { - print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc"); - } - elseif($conf->global->MAIN_INFO_LOCALTAX_CALC1==1) - { - print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"); - } - elseif($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){ - print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"); - } - - print '
"; - print "
'; - print "global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code); - print ($example!="LocalTax1IsNotUsedExample"?"\n":""); - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."
"; - print "
"; - print "
"; - } - if ($mysoc->useLocalTax(2)) // True if we found at least on vat with a setup adding a localtax 1 - { - // Local Tax 2 - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - - print ""; - print '\n"; - - - print ""; - print '\n"; - - print "
'.$langs->transcountry("LocalTax2Management", $mysoc->country_code).''.$langs->trans("Description").' 
"; - print "global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code); - print ($example!="LocalTax2IsUsedExample"?"\n":""); - if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0) - { - print ''; - } - print ''; - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."
'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'
'.$langs->trans("CalcLocaltax").': '; - if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0) - { - print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc"); - } - elseif($conf->global->MAIN_INFO_LOCALTAX_CALC2==1) - { - print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"); - } - elseif($conf->global->MAIN_INFO_LOCALTAX_CALC2==2) - { - print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"); - } - - print '
"; - print "
global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example=$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code); - print ($example!="LocalTax2IsNotUsedExample"?"\n":""); - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."
"; - print "
"; - print "
"; - } - - - // Actions buttons - print '
'; - print ''; - print '
'; } + +print '
'; +print ''; +print '
'; + +print ''; + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index bb2bfdde409..0955d7c6d17 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -68,7 +68,6 @@ if ($action == 'update') if (in_array($accounting_mode, $accounting_modes)) { - if (!dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { $error++; } diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 53555a35586..795a38c867d 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -118,7 +118,6 @@ if (! empty($consts) && $action == 'update') // Mass delete if (! empty($consts) && $action == 'delete') { - $nbdeleted=0; foreach($consts as $const) { @@ -164,7 +163,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp); // Add logic to show/hide buttons if ($conf->use_javascript_ajax) { -?> + ?> -trans("OtherSetup"), '', 'title_setup'); diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index e6c8c15c0d4..7f123c0f367 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -219,7 +219,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) { 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()) { - print ''.$module->nom."\n"; print $module->info(); print ''; @@ -359,7 +357,6 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); @@ -409,7 +406,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 47f668f69c3..7e724c52280 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -174,8 +174,8 @@ llxHeader(); print load_fiche_titre($langs->trans("DelaysOfToleranceBeforeWarning"), '', 'title_setup'); -print $langs->transnoentities("DelaysOfToleranceDesc", img_warning()); -print " ".$langs->trans("OnlyActiveElementsAreShown", DOL_URL_ROOT.'/admin/modules.php')."
\n"; +print ''.$langs->transnoentities("DelaysOfToleranceDesc", img_warning()); +print " ".$langs->trans("OnlyActiveElementsAreShown", DOL_URL_ROOT.'/admin/modules.php')."
\n"; print "
\n"; $countrynotdefined=''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; @@ -265,7 +265,6 @@ print '
'; print ''.$langs->trans("DescWeather").' '; if($action == 'edit') { - $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod')); $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; @@ -292,8 +291,6 @@ $text=''; $options='class="valignmiddle" height="60px"'; if ($action == 'edit') { - - print '
global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>'; print '
'; @@ -364,9 +361,7 @@ if ($action == 'edit') { global->MAIN_USE_METEO_WITH_PERCENTAGE)) { - print '
'; print '
'; print img_weather($text, 0, $options); @@ -386,7 +381,6 @@ if ($action == 'edit') { print '
'; print '
'; } else { - print '
'; print '
'; print img_weather($text, 0, $options); @@ -411,11 +405,9 @@ if ($action == 'edit') { print '
'; if($action == 'edit') { - print '
'; print '
'; } else { - print '
'; } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 31ade656480..af61dd1c09f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -551,27 +551,27 @@ $elementList = array(); $sourceList=array(); if ($id == 11) { - $elementList = array( - '' => '', - 'societe' => $langs->trans('ThirdParty'), -// 'proposal' => $langs->trans('Proposal'), -// 'order' => $langs->trans('Order'), -// 'invoice' => $langs->trans('Bill'), - 'supplier_proposal' => $langs->trans('SupplierProposal'), - 'order_supplier' => $langs->trans('SupplierOrder'), - 'invoice_supplier' => $langs->trans('SupplierBill'), -// 'intervention' => $langs->trans('InterventionCard'), -// 'contract' => $langs->trans('Contract'), - 'project' => $langs->trans('Project'), - 'project_task' => $langs->trans('Task'), - 'agenda' => $langs->trans('Agenda'), - 'dolresource' => $langs->trans('Resource'), - // old deprecated - 'propal' => $langs->trans('Proposal'), - 'commande' => $langs->trans('Order'), - 'facture' => $langs->trans('Bill'), - 'fichinter' => $langs->trans('InterventionCard'), - 'contrat' => $langs->trans('Contract') + $elementList = array( + '' => '', + 'societe' => $langs->trans('ThirdParty'), + // 'proposal' => $langs->trans('Proposal'), + // 'order' => $langs->trans('Order'), + // 'invoice' => $langs->trans('Bill'), + 'supplier_proposal' => $langs->trans('SupplierProposal'), + 'order_supplier' => $langs->trans('SupplierOrder'), + 'invoice_supplier' => $langs->trans('SupplierBill'), + // 'intervention' => $langs->trans('InterventionCard'), + // 'contract' => $langs->trans('Contract'), + 'project' => $langs->trans('Project'), + 'project_task' => $langs->trans('Task'), + 'agenda' => $langs->trans('Agenda'), + 'dolresource' => $langs->trans('Resource'), + // old deprecated + 'propal' => $langs->trans('Proposal'), + 'commande' => $langs->trans('Order'), + 'facture' => $langs->trans('Bill'), + 'fichinter' => $langs->trans('InterventionCard'), + 'contrat' => $langs->trans('Contract'), ); 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) { $localtax_typeList = array( - "0" => $langs->trans("No"), - "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"), - "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"), - "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"), - "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"), - "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), - "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"), + "0" => $langs->trans("No"), + "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"), + "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"), + "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"), + "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"), + "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), + "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 && (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 ) - ) - { + ) { $ok=0; $fieldnamekey=$listfield[$f]; // We take translate key of field @@ -1562,18 +1561,18 @@ if ($id) $class="center"; } elseif ($fieldlist[$field]=='localtax1_type') { - if ($obj->localtax1 != 0) - $valuetoshow=$localtax_typeList[$valuetoshow]; - else - $valuetoshow = ''; - $align="center"; + if ($obj->localtax1 != 0) + $valuetoshow=$localtax_typeList[$valuetoshow]; + else + $valuetoshow = ''; + $align="center"; } elseif ($fieldlist[$field]=='localtax2_type') { - if ($obj->localtax2 != 0) - $valuetoshow=$localtax_typeList[$valuetoshow]; - else - $valuetoshow = ''; - $align="center"; + if ($obj->localtax2 != 0) + $valuetoshow=$localtax_typeList[$valuetoshow]; + else + $valuetoshow = ''; + $align="center"; } elseif ($fieldlist[$field]=='taux') { $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); @@ -1728,7 +1727,6 @@ else { if ($showemptyline) { - print '   '; $showemptyline=0; } diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index c6262e84a79..e5acf71857e 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -18,10 +18,10 @@ * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * -* @author PrestaShop SA -* @copyright 2007-2013 PrestaShop SA -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA * PrestaShop Webservice Library * @package PrestaShopWebservice */ @@ -395,49 +395,6 @@ class PrestaShopWebservice self::checkStatusCode($request['status_code']);// check the response validity return self::parseXML($request['response']); } - - /** - * Delete (DELETE) a resource. - * Unique parameter must take :

- * 'resource' => Resource name
- * 'id' => ID or array which contains IDs of a resource(s) you want to delete

- * - * delete(array('resource' => 'orders', 'id' => 1)); - * // Following code will not be executed if an exception is thrown. - * echo 'Successfully deleted.'; - * } - * catch (PrestaShopWebserviceException $ex) - * { - * echo 'Error : '.$ex->getMessage(); - * } - * ?> - * - * - * @param array $options Array representing resource to delete. - * @return boolean True - */ - public function delete($options) - { - if (isset($options['url'])) - $url = $options['url']; - elseif (isset($options['resource']) && isset($options['id'])) - if (is_array($options['id'])) - $url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']'; - else - $url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; - if (isset($options['id_shop'])) - $url .= '&id_shop='.$options['id_shop']; - if (isset($options['id_group_shop'])) - $url .= '&id_group_shop='.$options['id_group_shop']; - $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE')); - self::checkStatusCode($request['status_code']);// check the response validity - return true; - } } /** diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 4951f57c22f..22029b2c691 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -32,8 +32,8 @@ class Dolistore * beginning of pagination * @var int */ + public $start; - public $start; /** * end of pagination * @var int @@ -226,7 +226,6 @@ class Dolistore $html .= self::get_categories($cat->id); $html .= "\n"; } else { - } } diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 255fdb68a0d..daa0c896809 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -513,7 +513,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $noparam=array(); foreach($arrayoftypes as $key => $value) { - if ($value['noparam']) $noparam[]=$key; + if ($value['noparam']) $noparam[]=$key; } print '})'; print ''."\n"; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index e8dbfab9942..7cc2e7dff44 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -366,7 +366,6 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); @@ -416,7 +415,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 8dde3449b6e..8a5cef82ceb 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -247,7 +247,6 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - print ''.$module->nom."\n"; print $module->info(); print ''; @@ -367,10 +366,8 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { - $name = substr($file, 4, dol_strlen($file) -16); $classname = substr($file, 0, dol_strlen($file) -12); diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index d16f3e493f5..4bb2bf1c964 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -79,7 +79,7 @@ if ($action == 'add' || GETPOST("modify")) if ($_POST["modify"]) { // Supprime boite box_external_rss de definition des boites -/* $sql = "UPDATE ".MAIN_DB_PREFIX."boxes_def"; + /* $sql = "UPDATE ".MAIN_DB_PREFIX."boxes_def"; $sql.= " SET name = '".$boxlabel."'"; $sql.= " WHERE file ='box_external_rss.php' AND note like '".$_POST["norss"]." %'"; @@ -89,7 +89,7 @@ if ($action == 'add' || GETPOST("modify")) dol_print_error($db,"sql=$sql"); exit; } -*/ + */ } else { @@ -300,7 +300,6 @@ if ($resql) // Logo if ($result > 0 && empty($rss->error)) { - print ''; print "".$langs->trans("Logo").""; print ''; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 759038930ef..dccfcdfdda1 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -720,7 +720,6 @@ if ($resql) $i = 0; while ($i < $num) { - $row = $db->fetch_row($resql); print '
'; print '
'; -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) -{ +if ($conf->global->MAIN_FEATURES_LEVEL < 2) { + dol_fiche_end(); + // End of page + llxFooter(); + $db->close(); + exit; +} /* * Documents models for Holidays @@ -319,8 +323,8 @@ $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); if ($resql) { - $i = 0; - $num_rows=$db->num_rows($resql); + $i = 0; + $num_rows=$db->num_rows($resql); while ($i < $num_rows) { $array = $db->fetch_array($resql); @@ -369,7 +373,6 @@ foreach ($dirmodels as $reldir) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) -16); @@ -419,7 +422,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') @@ -521,7 +524,7 @@ print ''; print '
'; print ''; -} + dol_fiche_end(); diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index b07a7984e09..dfbb548f5e0 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -222,375 +222,218 @@ $formadmin=new FormAdmin($db); print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup'); print ''.$langs->trans("DisplayDesc")."
\n"; -print "
\n"; +//WYSIWYG Editor +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -if ($action == 'edit') // Edit +print '
'; +print ''; +print ''; + +clearstatcache(); + +print '
'; +print ''; +print ''; +print ''; +print ''; + +// Default language +print ''; +print ''; +print ''; + +// Multilingual GUI +print ''; +print ''; +print ''; + +print '
'.$langs->trans("Language").' 
'.$langs->trans("DefaultLanguage").''; +print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2); +print ' 
'.$langs->trans("EnableMultilangInterface").''; +print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1); +print ' 

'."\n"; + +// Themes and themes options +showSkins(null, 1); +print '
'; + +// Other +print ''; +print ''; +print ''; +print ''; + +// Disable javascript and ajax +print ''; +print ''; +print ''; + +// Max size of lists +print ''; +print ''; +print ''; + +// Max size of short lists on customer card +print ''; +print ''; +print ''; + +// show input border +/* + print ''; + print ''; + print ''; + */ + +// First day for weeks +print ''; +print ''; +print ''; + +// DefaultWorkingDays +print ''; +print ''; +print ''; + +// DefaultWorkingHours +print ''; +print ''; +print ''; + +// Firstname/Name +print ''; +print ''; +print ''; + +// Hide unauthorized button +print ''; +print ''; +print ''; + +// Hide version link +/* + +print ''; +print ''; +print ''; +*/ + +// Show bugtrack link +print ''; +print ''; +print ''; + +// Hide wiki link on login page +$pictohelp=''; +print ''; +print ''; +print ''; + +// Message of the day on home page +$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount')); +complete_substitutions_array($substitutionarray, $langs); + +print ''."\n"; + +print '
'.$langs->trans("Miscellaneous").' 
'.$langs->trans("DisableJavascript").''; +print $form->selectyesno('MAIN_DISABLE_JAVASCRIPT', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1); +print ' 
'.$langs->trans("DefaultMaxSizeList").' 
'.$langs->trans("DefaultMaxSizeShortList").' 
'.$langs->trans("showInputBorder").''; + print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1); + print ' 
'.$langs->trans("WeekStartOnDay").''; +print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0); +print ' 
'.$langs->trans("DefaultWorkingDays").''; +print ''; +print ' 
'.$langs->trans("DefaultWorkingHours").''; +print ''; +print ' 
'.$langs->trans("FirstnameNamePosition").''; +$array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname")); +print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0)); +print ' 
'.$langs->trans("ButtonHideUnauthorized").''; +print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0, 1); +print ' 
'.$langs->trans("HideVersionLink").''; +print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1); +print ' 
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; +print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1); +print ' 
'.$langs->trans("DisableLinkToHelp", $pictohelp).''; +print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0, 1); +print ' 
'; +$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; +foreach($substitutionarray as $key => $val) { - //WYSIWYG Editor - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - - print ''; - print ''; - print ''; - - clearstatcache(); - - print '
'; - print ''; - print ''; - print ''; - print ''; - - // Default language - print ''; - print ''; - print ''; - - // Multilingual GUI - print ''; - print ''; - print ''; - - print '
'.$langs->trans("Language").' 
'.$langs->trans("DefaultLanguage").''; - print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2); - print ' 
'.$langs->trans("EnableMultilangInterface").''; - print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1); - print ' 

'."\n"; - - // Themes and themes options - showSkins(null, 1); - print '
'; - - // Other - print ''; - print ''; - print ''; - print ''; - - // Disable javascript and ajax - print ''; - print ''; - print ''; - - // Max size of lists - print ''; - print ''; - print ''; - - // Max size of short lists on customer card - print ''; - print ''; - print ''; - - // show input border - /* - print ''; - print ''; - print ''; - */ - - // First day for weeks - print ''; - print ''; - print ''; - - // DefaultWorkingDays - print ''; - print ''; - print ''; - - // DefaultWorkingHours - print ''; - print ''; - print ''; - - // Firstname/Name - print ''; - print ''; - print ''; - - // Hide unauthorized button - print ''; - print ''; - print ''; - - // Show logo - print ''; - print ''; - print ''; - - // Hide version link - /* - - print ''; - print ''; - print ''; - */ - - // Show bugtrack link - print ''; - print ''; - print ''; - - // Hide wiki link on login page - $pictohelp=''; - print ''; - print ''; - print ''; - - // Message of the day on home page - $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount')); - complete_substitutions_array($substitutionarray, $langs); - - print ''."\n"; - - print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("DisableJavascript").''; - print $form->selectyesno('MAIN_DISABLE_JAVASCRIPT', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1); - print ' 
'.$langs->trans("DefaultMaxSizeList").' 
'.$langs->trans("DefaultMaxSizeShortList").' 
'.$langs->trans("showInputBorder").''; - print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1); - print ' 
'.$langs->trans("WeekStartOnDay").''; - print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0); - print ' 
'.$langs->trans("DefaultWorkingDays").''; - print ''; - print ' 
'.$langs->trans("DefaultWorkingHours").''; - print ''; - print ' 
'.$langs->trans("FirstnameNamePosition").''; - $array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname")); - print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0)); - print ' 
'.$langs->trans("ButtonHideUnauthorized").''; - print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0, 1); - print ' 
'.$langs->trans("EnableShowLogo").''; - print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1); - print ' 
'.$langs->trans("HideVersionLink").''; - print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1); - print ' 
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; - print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1); - print ' 
'.$langs->trans("DisableLinkToHelp", $pictohelp).''; - print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0, 1); - print ' 
'; - $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; - foreach($substitutionarray as $key => $val) - { - $texthelp.=$key.'
'; - } - print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday'); - - print '
'; - - $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); - $doleditor->Create(); - - print '
'."\n"; - - print '
'; - - // Other - print ''; - print ''; - print ''; - print ''; - - // Message on login page - $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user')); - complete_substitutions_array($substitutionarray, $langs); - print ''."\n"; - - // Hide helpcenter link on login page - print ''; - print ''; - print ''; - - // Background - print ''; - - print '
'.$langs->trans("LoginPage").' 
'; - $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; - foreach($substitutionarray as $key => $val) - { - $texthelp.=$key.'
'; - } - print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin'); - print '
'; - $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); - $doleditor->Create(); - print '
'.$langs->trans("DisableLinkToHelpCenter").''; - print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0, 1); - print ' 
'; - print '
'; - print ''; - if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { - print ''.img_delete($langs->trans("Delete")).''; - if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) { - print '   '; - print ''; - } - } else { - print ''; - } - print '
'; - print '
'."\n"; - - - print '
'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; - print '
'; - - print ''; + $texthelp.=$key.'
'; } -else // Show +print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday'); + +print '
'; + +$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); +$doleditor->Create(); + +print '
'."\n"; + +print '
'; + +// Other +print ''; +print ''; +print ''; +print ''; + +// Message on login page +$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user')); +complete_substitutions_array($substitutionarray, $langs); +print ''."\n"; + +// Hide helpcenter link on login page +print ''; +print ''; +print ''; + +// Background +print ''; + +print '
'.$langs->trans("LoginPage").' 
'; +$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; +foreach($substitutionarray as $key => $val) { - // Language - print ''; - print ''; - - print ''; - print ''; - print ""; - - print ''; - print ''; - print ""; - - print '
'.$langs->trans("Language").'  
'.$langs->trans("DefaultLanguage").''; - $s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); - print ($s?$s.' ':''); - print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); - print ''; - if ($user->admin && $conf->global->MAIN_LANG_DEFAULT!='auto') print info_admin($langs->trans("SubmitTranslation".($conf->global->MAIN_LANG_DEFAULT=='en_US'?'ENUS':''), $conf->global->MAIN_LANG_DEFAULT), 1); - print '
'.$langs->trans("EnableMultilangInterface").'' . yn($conf->global->MAIN_MULTILANGS) . ' 

'."\n"; - - - // Themes - showSkins(null, 0); - print '
'; - - - // Other - print ''; - print ''; - - // Disable javascript/ajax - print '"; - print ""; - - // Max size of lists - print ''; - print ""; - - // Max size of short lists - print ''; - print ""; - - // First day for weeks - print ''; - print ''; - - // DefaultWorkingDays - print ''; - print ''; - - // DefaultWorkingHours - print ''; - print ''; - - // Firstname / Name position - print ''; - print ''; - - // Hide unauthorized button - print ''; - - // Show logo - print ''; - print ""; - - // Hide version link - /* - print ''; - print ''; - */ - - // Show bugtrack link - print '"; - print ""; - - // Link to wiki help - $pictohelp=''; - print ''; - - // Message of the day - print ''."\n"; - - print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("DisableJavascript").''; - print yn($conf->global->MAIN_DISABLE_JAVASCRIPT); - print '   -   '.$langs->trans("DisableJavascriptNote").''; - print "
'.$langs->trans("DefaultMaxSizeList").'' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '
'.$langs->trans("DefaultMaxSizeShortList").'' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '
'.$langs->trans("WeekStartOnDay").''; - print $langs->trans("Day".(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1')); - print '
'.$langs->trans("DefaultWorkingDays").''; - print isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5'; - print '
'.$langs->trans("DefaultWorkingHours").''; - print isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18'; - print '
'.$langs->trans("FirstnameNamePosition").''; - if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { print $langs->trans("Firstname").' '.$langs->trans("Lastname"); } - else { print $langs->trans("Lastname").' '.$langs->trans("Firstname"); } - print '
'.$langs->trans("ButtonHideUnauthorized").''; - print yn((isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0), 1); - print '
'.$langs->trans("EnableShowLogo").'' . yn($conf->global->MAIN_SHOW_LOGO) . '
'.$langs->trans("HideVersionLink").''; - print yn($conf->global->MAIN_HIDE_VERSION); - print '
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; - print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)."
'.$langs->trans("DisableLinkToHelp", $pictohelp).''; - print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0), 1); - print '
'.$langs->trans("MessageOfDay").''; - if (isset($conf->global->MAIN_MOTD)) print dol_htmlcleanlastbr($conf->global->MAIN_MOTD); - else print ' '; - print '
'."\n"; - - print '
'; - - // Login page - print '
'; - - print ''; - print ''; - - // Message login - print ''."\n"; - - // Link to help center - print ''; - - // Background login - print ''; - - print '
'.$langs->trans("LoginPage").'
'.$langs->trans("MessageLogin").''; - if (isset($conf->global->MAIN_HOME)) print dol_htmlcleanlastbr($conf->global->MAIN_HOME); - else print ' '; - print '
'.$langs->trans("DisableLinkToHelpCenter").''; - print yn((isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0), 1); - print '
'.$langs->trans("BackgroundImageLogin").''; - print '
'; - print $conf->global->MAIN_LOGIN_BACKGROUND; - if ($conf->global->MAIN_LOGIN_BACKGROUND && is_file($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) - { - print ''; - } - else - { - print ''; - } - print '
'; - print '
'."\n"; - print '
'; - - print '
'; - print ''.$langs->trans("Modify").''; - print '
'; + $texthelp.=$key.'
'; } +print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin'); +print '
'; +$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); +$doleditor->Create(); +print '
'.$langs->trans("DisableLinkToHelpCenter").''; +print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0, 1); +print ' 
'; +print '
'; +$disabled = ''; +if (! empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) $disabled = ' disabled="disabled"'; +print ''; +if ($disabled) +{ + print '('.$langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND").') '; +} +if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { + print ''.img_delete($langs->trans("Delete")).''; + if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) { + print '   '; + print ''; + } +} else { + print ''; +} +print '
'; +print '
'."\n"; + + +print '
'; +print '
'; +print ''; +print '
'; + +print ''; + // End of page llxFooter(); diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index cba9481849d..8d1f7d3279e 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -478,7 +478,7 @@ if (function_exists("ldap_connect")) } } else - { + { setEventMessages($ldap->error, $ldap->errors, 'errors'); } diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index c9e69cc469e..27f99ecb4f1 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -90,7 +90,7 @@ llxHeader(); print load_fiche_titre($langs->trans("LimitsSetup"), '', 'title_setup'); -print $langs->trans("LimitsDesc")."
\n"; +print ''.$langs->trans("LimitsDesc")."
\n"; print "
\n"; if ($action == 'edit') @@ -172,7 +172,6 @@ if (empty($mysoc->country_code)) } else { - // Show examples print ''.$langs->trans("ExamplesWithCurrentSetup").":
\n"; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 1f8a74f6eb8..794020cfc95 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -139,7 +139,7 @@ if ($action == 'set') if ($action == 'del') { - $ret = delDocumentModel($value, $type); + $ret = delDocumentModel($value, $type); if ($ret > 0) { if ($conf->global->LIVRAISON_ADDON_PDF == "$value") dolibarr_del_const($db, 'LIVRAISON_ADDON_PDF', $conf->entity); @@ -356,8 +356,6 @@ foreach ($dirmodels as $reldir) { if (file_exists($dir.'/'.$file)) { - - $name = substr($file, 4, dol_strlen($file) -16); $classname = substr($file, 0, dol_strlen($file) -12); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index ff2b788a026..61fb0448c8b 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -65,27 +65,27 @@ complete_substitutions_array($substitutionarrayfortest, $langs); if ($action == 'update' && empty($_POST["cancel"])) { - dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS", 'int'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT", 'int'), 'chaine', 0, '', $conf->entity); // Send mode parameters - dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE", 'aZ09'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT", 'int'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW", 'none'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS", 'int'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS", 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY"), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED", 'int'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", 'alphanohtml'), 'chaine', 0, '', $conf->entity); // Content parameters - dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE', 'alphanohtml'), 'chaine', 0, '', $conf->entity); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); exit; @@ -101,8 +101,8 @@ $mode='emailfortest'; $trackid=(($action == 'testhtml')?"testhtml":"test"); include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; -if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test'; -if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtml'; +if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action='test'; +if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $action='testhtml'; @@ -364,7 +364,6 @@ if ($action == 'edit') // ID if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { - $mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID)?$conf->global->MAIN_MAIL_SMTPS_ID:''); print ''.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only @@ -384,7 +383,6 @@ if ($action == 'edit') // PW if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { - $mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:''); print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").''; // SuperAdministrator access only @@ -823,7 +821,7 @@ else $formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->fromid=$user->id; $formmail->fromalsorobot=1; - $formmail->fromtype=(GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); + $formmail->fromtype=(GETPOSTISSET('fromtype')?GETPOST('fromtype', 'aZ09'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); $formmail->withfromreadonly=1; $formmail->withsubstit=1; $formmail->withfrom=1; @@ -849,7 +847,7 @@ else $formmail->param["returnurl"]=$_SERVER["PHP_SELF"]; // Init list of files - if (GETPOST("mode")=='init') + if (GETPOST("mode", "aZ09")=='init') { $formmail->clear_attached_files(); } diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 3d6cfc2d228..94f3820c5b9 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -316,7 +316,6 @@ if ($action == 'edit') // ID if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { - $mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING)?$conf->global->MAIN_MAIL_SMTPS_ID_EMAILING:''); print ''.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 0dbdf90b53b..7ac91d51c8d 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -45,11 +45,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; // Load translation files required by the page $langs->loadLangs(array("errors","admin","mails","languages")); -$action = GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):'view'; -$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$action = GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):'view'; +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation -$id = GETPOST('id', 'int'); -$rowid = GETPOST('rowid', 'alpha'); +$id = GETPOST('id', 'int'); +$rowid = GETPOST('rowid', 'alpha'); $search_label=GETPOST('search_label', 'alphanohtml'); // Must allow value like 'Abc Def' or '(MyTemplateName)' $search_type_template=GETPOST('search_type_template', 'alpha'); $search_lang=GETPOST('search_lang', 'alpha'); @@ -327,7 +327,7 @@ if (empty($reshook)) $i++; } $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; -//print $sql;exit; + //print $sql;exit; dol_syslog("actionmodify", LOG_DEBUG); //print $sql; $resql = $db->query($sql); diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index b334ccadf45..4187c4d3eb4 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -159,116 +159,63 @@ print ''.$langs->trans("MenusDesc")."
\n"; print "
\n"; -if ($action == 'edit') -{ - clearstatcache(); +clearstatcache(); - // Gestionnaires de menu - print ''; - print ''; - print ''; - print ''; - print ''; +// Gestionnaires de menu +print '
'.$langs->trans("Menu").''; - print $form->textwithpicto($langs->trans("InternalUsers"), $langs->trans("InternalExternalDesc")); - print ''; - print $form->textwithpicto($langs->trans("ExternalUsers"), $langs->trans("InternalExternalDesc")); - print '
'; +print ''; +print ''; +print ''; +print ''; - // Menu top - print ''; - print ''; - print ''; - print ''; +// Menu top +print ''; +print ''; +print ''; +print ''; - // Menu smartphone - print ''; - print ''; - print ''; - print ''; +// Menu smartphone +print ''; +print '
'.$langs->trans("Menu").''; +print $form->textwithpicto($langs->trans("InternalUsers"), $langs->trans("InternalExternalDesc")); +print ''; +print $form->textwithpicto($langs->trans("ExternalUsers"), $langs->trans("InternalExternalDesc")); +print '
'.$langs->trans("DefaultMenuManager").''; - $formadmin->select_menu(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED, 'MAIN_MENU_STANDARD', $dirstandard, empty($conf->global->MAIN_MENU_STANDARD_FORCED)?'':' disabled'); - print ''; - $formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED, 'MAIN_MENUFRONT_STANDARD', $dirstandard, empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?'':' disabled'); - print '
'.$langs->trans("DefaultMenuManager").''; +$formadmin->select_menu(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED, 'MAIN_MENU_STANDARD', $dirstandard, empty($conf->global->MAIN_MENU_STANDARD_FORCED)?'':' disabled'); +print ''; +$formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED, 'MAIN_MENUFRONT_STANDARD', $dirstandard, empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?'':' disabled'); +print '
'.$langs->trans("DefaultMenuSmartphoneManager").''; - $formadmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED, 'MAIN_MENU_SMARTPHONE', array_merge($dirstandard, $dirsmartphone), empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?'':' disabled'); - print ''; - $formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED, 'MAIN_MENUFRONT_SMARTPHONE', array_merge($dirstandard, $dirsmartphone), empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?'':' disabled'); - print '
'.$langs->trans("DefaultMenuSmartphoneManager").''; +$formadmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED, 'MAIN_MENU_SMARTPHONE', array_merge($dirstandard, $dirsmartphone), empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?'':' disabled'); - print '
'; -} -else -{ - // Gestionnaires de menu - print ''; - print ''; - print ''; - print ''; - print ''; - - - print ''; - print ''; - print ''; - print ''; - - - print ''; - print ''; - print ''; - print ''; - print ''; - - print '
'.$langs->trans("Menu").''; - print $form->textwithpicto($langs->trans("InternalUsers"), $langs->trans("InternalExternalDesc")); - print ''; - print $form->textwithpicto($langs->trans("ExternalUsers"), $langs->trans("InternalExternalDesc")); - print '
'.$langs->trans("DefaultMenuManager").''; - $filelib=preg_replace('/.php$/i', '', (empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED)); - print $filelib; - print ''; - $filelib=preg_replace('/.php$/i', '', (empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED)); - print $filelib; - print '
'.$langs->trans("DefaultMenuSmartphoneManager").''; - $filelib=preg_replace('/.php$/i', '', (empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED)); - print $filelib; - if (! empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && preg_match('/smartphone/', $conf->global->MAIN_MENU_SMARTPHONE_FORCED) +if (! empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && preg_match('/smartphone/', $conf->global->MAIN_MENU_SMARTPHONE_FORCED) || (empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && ! empty($conf->global->MAIN_MENU_SMARTPHONE) && preg_match('/smartphone/', $conf->global->MAIN_MENU_SMARTPHONE))) - { - print ' '.img_warning($langs->transnoentitiesnoconv("ThisForceAlsoTheme")); - } - print ''; - $filelib=preg_replace('/.php$/i', '', (empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)); - print $filelib; - if (! empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && preg_match('/smartphone/', $conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED) - || (empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED) && ! empty($conf->global->MAIN_MENU_SMARTPHONE) && preg_match('/smartphone/', $conf->global->MAIN_MENUFRONT_SMARTPHONE))) - { - print ' '.img_warning($langs->transnoentitiesnoconv("ThisForceAlsoTheme")); - } - print '
'; +{ + print ' '.img_warning($langs->transnoentitiesnoconv("ThisForceAlsoTheme")); } +print ''; +print ''; +$formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED, 'MAIN_MENUFRONT_SMARTPHONE', array_merge($dirstandard, $dirsmartphone), empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?'':' disabled'); + +if (! empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && preg_match('/smartphone/', $conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED) + || (empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED) && ! empty($conf->global->MAIN_MENU_SMARTPHONE) && preg_match('/smartphone/', $conf->global->MAIN_MENUFRONT_SMARTPHONE))) +{ + print ' '.img_warning($langs->transnoentitiesnoconv("ThisForceAlsoTheme")); +} + +print ''; +print ''; + +print ''; + dol_fiche_end(); - -if ($action == 'edit') -{ - print '
'; - print ''; - print '       '; - print ''; - print '
'; -} +print '
'; +print ''; +print '
'; print ''; - -if ($action != 'edit') -{ - print '
'; - print ''.$langs->trans("Modify").''; - print '
'; -} - // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 43888d3e061..5a54a9e5c9f 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -323,7 +323,6 @@ if ($action == 'create') $res = $db->query($sql); if ($res) { - while ($menu = $db->fetch_array($res)) { $parent_rowid = $menu['rowid']; diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index d5b0f864be6..de9d1677932 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -21,7 +21,9 @@ * \brief Page to activate/disable all modules */ -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disabled because this page is into a popup on module search page and we want to avoid to have an Anti CSRF token error (done if MAIN_SECURITY_CSRF_WITH_TOKEN is on) when we make a second search after closing popup. + require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 787f3ded291..8bdfb978219 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -63,8 +63,6 @@ $dolistore = new Dolistore(false); if (! $user->admin) accessforbidden(); -$specialtostring=array(0=>'common', 1=>'interfaces', 2=>'other', 3=>'functional', 4=>'marketplace'); - $familyinfo=array( 'hr'=>array('position'=>'001', 'label'=>$langs->trans("ModuleFamilyHr")), 'crm'=>array('position'=>'006', 'label'=>$langs->trans("ModuleFamilyCrm")), @@ -190,7 +188,7 @@ if ($action=='install') //var_dump($modulenamedir); if (! dol_is_dir($modulenamedir)) { - setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'
Dir not found: '.$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename.'
'.$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename, null, 'errors'); + setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'
'.$langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename, 'htdocs/'.$modulename), null, 'errors'); $error++; } } @@ -368,11 +366,8 @@ foreach ($modulesdir as $dir) } } ksort($arrayofnatures); - } - // Define array $categ with categ with at least one qualified module - if ($modulequalified > 0) - { + // Define array $categ with categ with at least one qualified module $filename[$i]= $modName; $modules[$modName] = $objMod; @@ -400,7 +395,15 @@ foreach ($modulesdir as $dir) $arrayofwarningsext[$modName]=$objMod->warnings_activation_ext; } - $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number + $familyposition = $familyinfo[$familykey]['position']; + if ($external) + { + // TODO Find a solution so modules with their own family are always at end + //var_dump($familyposition); + //$familyposition += 100; + } + + $orders[$i] = $familyposition."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number $dirmod[$i] = $dir; //print $i.'-'.$dirmod[$i].'
'; // Set categ[$i] @@ -527,6 +530,7 @@ if ($mode == 'common') print '

'; + $object=new stdClass(); $parameters=array(); $reshook=$hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -538,14 +542,13 @@ if ($mode == 'common') foreach ($orders as $key => $value) { $tab=explode('_', $value); - $familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3]; + $familykey=$tab[1]; + $module_position=$tab[2]; $modName = $filename[$key]; $objMod = $modules[$modName]; - $dirofmodule = $dirmod[$key]; //print $objMod->name." - ".$key." - ".$objMod->version."
"; - //if (($mode != (isset($specialtostring[$special])?$specialtostring[$special]:'unknown') && $mode != 'expdev') if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') continue; // Discard if not for current tab if (! $objMod->getName()) @@ -729,7 +732,6 @@ if ($mode == 'common') print ''; } else { - print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; @@ -921,19 +923,17 @@ if ($mode == 'marketplace')  
- -
- + '; + print ''; -
'; - print '
'; + print '
'; + print '
'; - ?> + ?>
    diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index cc1d53d14f8..6d1a5c57cf6 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -164,7 +164,6 @@ print ''; $i=0; foreach($listofnotifiedevents as $notifiedevent) { - $label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); @@ -209,7 +208,6 @@ $listofnotifiedevents=$notificationtrigger->getListOfManagedEvents(); foreach($listofnotifiedevents as $notifiedevent) { - $label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 20c0ae222eb..bb3c83c2ee2 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -122,7 +122,6 @@ dol_fiche_head($head, 'tokengeneration', '', -1, 'technic'); if ($mode == 'setup' && $user->admin) { - print $langs->trans("OAuthSetupForLogin")."

    \n"; foreach($list as $key) @@ -381,7 +380,6 @@ if ($mode == 'userconf' && $user->admin) $sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid'; $resql = $db->query($sql); while ($row=$db->fetch_array($resql)) { - print ''; print ''.$row['login'].''; print ''.$row['module'].''; diff --git a/htdocs/admin/openinghours.php b/htdocs/admin/openinghours.php index d931cdbf230..c29f6816a05 100644 --- a/htdocs/admin/openinghours.php +++ b/htdocs/admin/openinghours.php @@ -29,7 +29,7 @@ $action=GETPOST('action', 'aZ09'); $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminaccoutant'; // To manage different context of search // Load translation files required by the page -$langs->loadLangs(array('admin', 'companies')); +$langs->loadLangs(array('admin', 'companies', 'other')); if (! $user->admin) accessforbidden(); @@ -66,6 +66,8 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) * View */ +$form = new Form($db); + $help_url=''; llxHeader('', $langs->trans("CompanyFoundation"), $help_url); @@ -75,12 +77,10 @@ $head = company_admin_prepare_head(); dol_fiche_head($head, 'openinghours', $langs->trans("Company"), -1, 'company'); -$form=new Form($db); - print ''.$langs->trans("OpeningHoursDesc")."
    \n"; print "
    \n"; -if ($action == 'edit' || $action == 'updateedit') +if (empty($action) || $action == 'edit' || $action == 'updateedit') { /** * Edit parameters @@ -92,66 +92,50 @@ if ($action == 'edit' || $action == 'updateedit') print ''; print ''."\n"; - print ''."\n"; + print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; print '
    '.$langs->trans("Day").''.$langs->trans("Value").'
    '; - print '
    '; + print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; + print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>
    '; + print '
    '; + print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
    '; + print '
    '; + print $form->textwithpicto($langs->trans("Wednesday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
    '; + print '
    '; + print $form->textwithpicto($langs->trans("Thursday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
    '; + print '
    '; + print $form->textwithpicto($langs->trans("Friday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
    '; + print '
    '; + print $form->textwithpicto($langs->trans("Saturday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
    '; + print '
    '; + print $form->textwithpicto($langs->trans("Sunday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
    '; print '
    '; print ''; - print '     '; - print ''; print '
    '; print '
    '; print ''; } -else -{ - /* - * Show parameters - */ - - print '
    '; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print '
    '.$langs->trans("Day").''.$langs->trans("Value").'
    '.$langs->trans("Monday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_MONDAY) . '
    '.$langs->trans("Tuesday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY) . '
    '.$langs->trans("Wednesday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY) . '
    '.$langs->trans("Thursday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY) . '
    '.$langs->trans("Friday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY) . '
    '.$langs->trans("Saturday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY) . '
    '.$langs->trans("Sunday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY) . '
    '; - print "
    "; - - print ''; - - // Actions buttons - print '
    '; - print ''; - print '
    '; -} llxFooter(); diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index a8c1aa41b5f..e9346f49a3a 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -123,460 +123,244 @@ print "
    \n"; $noCountryCode = (empty($mysoc->country_code) ? true : false); -if ($action == 'edit') // Edit +print '
    '; +print ''; +print ''; + +clearstatcache(); + + +// Misc options +print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', ''); + +print '
    '; +print ''; +print ''; + +$selected=$conf->global->MAIN_PDF_FORMAT; +if (empty($selected)) $selected=dol_getDefaultFormat(); + +// Show pdf format + +print ''; + +print ''; +print ''; +print ''; +print ''; + +print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("DictionaryPaperFormat").''; +print $formadmin->select_paper_format($selected, 'MAIN_PDF_FORMAT'); +print '
    '.$langs->trans("MAIN_PDF_MARGIN_LEFT").''; +print ''; +print '
    '.$langs->trans("MAIN_PDF_MARGIN_RIGHT").''; +print ''; +print '
    '.$langs->trans("MAIN_PDF_MARGIN_TOP").''; +print ''; +print '
    '.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").''; +print ''; +print '
    '; +print '
    '; + +print '
    '; + + +// Addresses +print load_fiche_titre($langs->trans("PDFAddressForging"), '', ''); + +print '
    '; +print ''; +print ''; + +// Hide VAT Intra on address + +print ''; + +// Show prof id in address into pdf +for($i=1; $i<=6; $i++) { - print ''; - print ''; - print ''; - - clearstatcache(); - - - // Misc options - print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', ''); - - print '
    '; - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("ShowVATIntaInAddress").''; +print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', (! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0, 1); +print '
    '; - print ''; - - $selected=$conf->global->MAIN_PDF_FORMAT; - if (empty($selected)) $selected=dol_getDefaultFormat(); - - // Show pdf format - - print ''; - - print ''; - print ''; - print ''; - print ''; - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("DictionaryPaperFormat").''; - print $formadmin->select_paper_format($selected, 'MAIN_PDF_FORMAT'); - print '
    '.$langs->trans("MAIN_PDF_MARGIN_LEFT").''; - print ''; - print '
    '.$langs->trans("MAIN_PDF_MARGIN_RIGHT").''; - print ''; - print '
    '.$langs->trans("MAIN_PDF_MARGIN_TOP").''; - print ''; - print '
    '.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").''; - print ''; - print '
    '; - print '
    '; - - print '
    '; - - - // Addresses - print load_fiche_titre($langs->trans("PDFAddressForging"), '', ''); - - print '
    '; - print ''; - print ''; - - // Hide VAT Intra on address - - print ''; - - // Show prof id in address into pdf - for($i=1; $i<=6; $i++) - { - if (! $noCountryCode) - { - $pid=$langs->transcountry("ProfId".$i, $mysoc->country_code); - if ($pid == '-') $pid=false; - } - else - { - $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid) - { - print ''; - } - } - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("ShowVATIntaInAddress").''; - print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', (! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0, 1); - print '
    '.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; - $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; - print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant)?$conf->global->$keyforconstant:0, 1, $noCountryCode); - print '
    '; - print '
    '; - - - print '
    '; - - - // Localtaxes - $locales =''; - $text=''; - if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) - { - if ($mysoc->useLocalTax(1)) - { - $locales = $langs->transcountry("LT1", $mysoc->country_code); - $text ='' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)) . ''; - $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1); - $text .= ''; - } - - if ($mysoc->useLocalTax(2)) - { - $locales.=($locales?' & ':'').$langs->transcountry("LT2", $mysoc->country_code); - - $text.= '' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)) . ''; - $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1); - $text.= ''; - } - } - - $title = $langs->trans("PDFRulesForSalesTax"); - if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) - { - $title.=' - '.$langs->trans("PDFLocaltax", $locales); - } - - print load_fiche_titre($title, '', ''); - - print ''; - print ''; - - // Hide any information on Sale tax / VAT - - print ''; - - // Locataxes - print $text; - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("HideAnyVATInformationOnPDF").''; - print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0, 1); - print '
    '; - print '
    '; - - - // Other - print load_fiche_titre($langs->trans("Other"), '', ''); - - print '
    '; - print ''; - print ''; - - //Desc - - print ''; - - //Ref - - print ''; - - //Details - - print ''; - - //Invert sender and recipient - - print ''; - - // Place customer adress to the ISO location - - print ''; - - - print ''; - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("HideDescOnPDF").''; - print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC:0, 1); - print '
    '.$langs->trans("HideRefOnPDF").''; - print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF:0, 1); - print '
    '.$langs->trans("HideDetailsOnPDF").''; - print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0, 1); - print '
    '.$langs->trans("SwapSenderAndRecipientOnPDF").''; - print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT))?$conf->global->MAIN_INVERT_SENDER_RECIPIENT:0, 1); - print '
    '.$langs->trans("PlaceCustomerAddressToIsoLocation").''; - print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (! empty($conf->global->MAIN_PDF_USE_ISO_LOCATION))?$conf->global->MAIN_PDF_USE_ISO_LOCATION:0, 1); - print '
    '.$langs->trans("ShowDetailsInPDFPageFoot").''; - print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS); - print '
    '; - print '
    '; - - print '
    '; - print ''; - print '   '; - print ''; - print '
    '; - - print '
    '; - print '
    '; -} -else // Show -{ - // Misc options - print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', ''); - - - print '
    '; - print ''; - print ''; - - // Show pdf format - - print ''; - - print ''; - print ''; - print ''; - print ''; - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("DictionaryPaperFormat").''; - - $pdfformatlabel=''; - if (empty($conf->global->MAIN_PDF_FORMAT)) - { - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $pdfformatlabel=dol_getDefaultFormat(); - } - else $pdfformatlabel=$conf->global->MAIN_PDF_FORMAT; - if (! empty($pdfformatlabel)) - { - $sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format"; - $sql.=" WHERE code LIKE '%".$db->escape($pdfformatlabel)."%'"; - - $resql=$db->query($sql); - if ($resql) - { - $obj=$db->fetch_object($resql); - $paperKey = $langs->trans('PaperFormat'.$obj->code); - $unitKey = $langs->trans('SizeUnit'.$obj->unit); - $pdfformatlabel = ($paperKey == 'PaperFormat'.$obj->code ? $obj->label : $paperKey).' - '.round($obj->width).'x'.round($obj->height).' '.($unitKey == 'SizeUnit'.$obj->unit ? $obj->unit : $unitKey); - } - } - print $pdfformatlabel; - print '
    '.$langs->trans("MAIN_PDF_MARGIN_LEFT").''; - print empty($conf->global->MAIN_PDF_MARGIN_LEFT)?10:$conf->global->MAIN_PDF_MARGIN_LEFT; - print '
    '.$langs->trans("MAIN_PDF_MARGIN_RIGHT").''; - print empty($conf->global->MAIN_PDF_MARGIN_RIGHT)?10:$conf->global->MAIN_PDF_MARGIN_RIGHT; - print '
    '.$langs->trans("MAIN_PDF_MARGIN_TOP").''; - print empty($conf->global->MAIN_PDF_MARGIN_TOP)?10:$conf->global->MAIN_PDF_MARGIN_TOP; - print '
    '.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").''; - print empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM; - print '
    '; - print '
    '; - - print '
    '; - - print load_fiche_titre($langs->trans("PDFAddressForging"), '', ''); - - print '
    '; - print ''; - print ''; - - // Hide Intra VAT on address - - print ''; - - // Show prof id in address into pdf - for ($i=1; $i<=6; $i++) + if (! $noCountryCode) { - if (! $noCountryCode) - { - $pid=$langs->transcountry("ProfId".$i, $mysoc->country_code); - if ($pid == '-') $pid=false; - } - else - { - $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid) - { - print ''; - } - } - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("ShowVATIntaInAddress").''; - print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS, 1); - print '
    '.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; - $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; - print yn($conf->global->$keyforconstant, 1); - print '
    '."\n"; - print '
    '; - - print '
    '; - - // Localtaxes - $locales =''; - $text=''; - if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) - { - if ($mysoc->useLocalTax(1)) - { - $locales = $langs->transcountry("LT1", $mysoc->country_code); - $text ='' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)) . ''; - $text .= yn($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX, 1); - $text .= ''; - } - - if ($mysoc->useLocalTax(2)) - { - $locales.=($locales?' & ':'').$langs->transcountry("LT2", $mysoc->country_code); - - $text.= '' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)) . ''; - $text.= yn($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX, 1); - $text.= ''; - } - } - - // Sales TAX / VAT information - $title=$langs->trans("PDFRulesForSalesTax", $locales); - if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) $title.=' - '.$langs->trans("PDFLocaltax", $locales); - - print load_fiche_titre($title, '', ''); - - print ''; - print ''; - - print ''; - - print $text; - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("HideAnyVATInformationOnPDF").''; - print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT, 1); - print '
    '; - print '
    '; - - - // Other - print load_fiche_titre($langs->trans("Other"), '', ''); - - print '
    '; - print ''; - print ''; - - // Encrypt and protect PDF - - print ''; - print ''; - print ''; - print '"; - - print ""; - print ''; - - // Hide Desc - - print ''; - - // Hide Ref - - print ''; - - // Hide Details - - print ''; - - // Invert sender and recipient - print ''; - - // Use French location - print ''; - - - print ''; - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '; - $text = $langs->trans("ProtectAndEncryptPdfFiles"); - $desc = $form->textwithpicto($text, $langs->transnoentities("ProtectAndEncryptPdfFilesDesc"), 1); - print $desc; - print ''; - if($conf->global->PDF_SECURITY_ENCRYPTION == 1) - { - print img_picto($langs->trans("Active"), 'tick'); - } - print ''; - if (empty($conf->global->PDF_SECURITY_ENCRYPTION)) - { - print ''.$langs->trans("Activate").''; + $pid=$langs->transcountry("ProfId".$i, $mysoc->country_code); + if ($pid == '-') $pid=false; } else { - print ''.$langs->trans("Disable").''; + $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } - print "
    '.$langs->trans("HideDescOnPDF").''; - print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC, 1); - print '
    '.$langs->trans("HideRefOnPDF").''; - print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF, 1); - print '
    '.$langs->trans("HideDetailsOnPDF").''; - print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS, 1); - print '
    '.$langs->trans("SwapSenderAndRecipientOnPDF").''; - print yn($conf->global->MAIN_INVERT_SENDER_RECIPIENT, 1); - print '
    '.$langs->trans("PlaceCustomerAddressToIsoLocation").''; - print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION, 1); - print '
    '.$langs->trans("ShowDetailsInPDFPageFoot").''; - print $arraydetailsforpdffoot[($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)]; - print '
    '; - print '
    '; - - - /* - * Library - */ - - print '
    '; - print load_fiche_titre($langs->trans("Library"), '', ''); - - print '
    '; - print ''."\n"; - - print ''."\n"; - print ''."\n"; - print ''."\n"; - print "\n"; - - print ''."\n"; - print ''."\n"; - print ''; } - if (class_exists('TCPDF')) - { - if ($i) print ' + '; - print 'TCPDF'; - print ' ('.@constant('TCPDF_PATH').')'; - $i++; - } - if (class_exists('FPDI')) - { - if ($i) print ' + '; - print 'FPDI'; - print ' ('.@constant('FPDI_PATH').')'; - $i++; - } - if (class_exists('TCPDI')) - { - if ($i) print ' + '; - print 'TCPDI'; - print ' ('.@constant('TCPDI_PATH').')'; - $i++; - } - print ''."\n"; - print ''."\n"; - - print "
    '.$langs->trans("Name").''.$langs->trans("Value").'
    '.$langs->trans("LibraryToBuildPDF").''; - $i=0; - $pdf=pdf_getInstance('A4'); - if (class_exists('FPDF') && ! class_exists('TCPDF')) + if ($pid) { - if ($i) print ' + '; - print 'FPDF'; - print ' ('.@constant('FPDF_PATH').')'; - $i++; + print '
    '.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; + $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; + print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant)?$conf->global->$keyforconstant:0, 1, $noCountryCode); + print '
    \n"; - print '
    '; - - print '
    '; - print ''.$langs->trans("Modify").''; - print '
    '; - print '
    '; } +print ''; +print '
'; + + +print '
'; + + +// Localtaxes +$locales =''; +$text=''; +if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) +{ + if ($mysoc->useLocalTax(1)) + { + $locales = $langs->transcountry("LT1", $mysoc->country_code); + $text ='' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)) . ''; + $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1); + $text .= ''; + } + + if ($mysoc->useLocalTax(2)) + { + $locales.=($locales?' & ':'').$langs->transcountry("LT2", $mysoc->country_code); + + $text.= '' . $langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)) . ''; + $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1); + $text.= ''; + } +} + +$title = $langs->trans("PDFRulesForSalesTax"); +if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) +{ + $title.=' - '.$langs->trans("PDFLocaltax", $locales); +} + +print load_fiche_titre($title, '', ''); + +print ''; +print ''; + +// Hide any information on Sale tax / VAT + +print ''; + +// Locataxes +print $text; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("HideAnyVATInformationOnPDF").''; +print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0, 1); +print '
'; +print '
'; + + +// Other +print load_fiche_titre($langs->trans("Other"), '', ''); + +print '
'; +print ''; +print ''; + +//Desc + +print ''; + +//Ref + +print ''; + +//Details + +print ''; + +//Invert sender and recipient + +print ''; + +// Place customer adress to the ISO location + +print ''; + + +print ''; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("HideDescOnPDF").''; +print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC:0, 1); +print '
'.$langs->trans("HideRefOnPDF").''; +print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF:0, 1); +print '
'.$langs->trans("HideDetailsOnPDF").''; +print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0, 1); +print '
'.$langs->trans("SwapSenderAndRecipientOnPDF").''; +print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT))?$conf->global->MAIN_INVERT_SENDER_RECIPIENT:0, 1); +print '
'.$langs->trans("PlaceCustomerAddressToIsoLocation").''; +print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (! empty($conf->global->MAIN_PDF_USE_ISO_LOCATION))?$conf->global->MAIN_PDF_USE_ISO_LOCATION:0, 1); +print '
'.$langs->trans("ShowDetailsInPDFPageFoot").''; +print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS); +print '
'; +print '
'; + + +/* + * Library + */ + +print '
'; +print load_fiche_titre($langs->trans("Library"), '', ''); + +print '
'; +print ''."\n"; + +print ''."\n"; +print ''."\n"; +print ''."\n"; +print "\n"; + +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + +print "
'.$langs->trans("Name").''.$langs->trans("Value").'
'.$langs->trans("LibraryToBuildPDF").''; +$i=0; +$pdf=pdf_getInstance('A4'); +if (class_exists('FPDF') && ! class_exists('TCPDF')) +{ + if ($i) print ' + '; + print 'FPDF'; + print ' ('.@constant('FPDF_PATH').')'; + $i++; +} +if (class_exists('TCPDF')) +{ + if ($i) print ' + '; + print 'TCPDF'; + print ' ('.@constant('TCPDF_PATH').')'; + $i++; +} +if (class_exists('FPDI')) +{ + if ($i) print ' + '; + print 'FPDI'; + print ' ('.@constant('FPDI_PATH').')'; + $i++; +} +if (class_exists('TCPDI')) +{ + if ($i) print ' + '; + print 'TCPDI'; + print ' ('.@constant('TCPDI_PATH').')'; + $i++; +} +print '
\n"; +print '
'; + + +print '
'; +print ''; +print '
'; + +print ''; + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 4c8f4188e4b..a0f817a40c1 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -294,7 +294,6 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - print ''.$module->nom."\n"; print $module->info(); print ''; @@ -468,7 +467,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = $langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') @@ -596,7 +595,6 @@ if (empty($conf->facture->enabled)) $i = 0; while ($i < $num) { - $row = $db->fetch_row($resql); print '